summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2016-02-19 19:24:55 +0200
committerLars Wirzenius <liw@liw.fi>2016-02-19 19:39:03 +0200
commit257bfcb994a8cd823376157cea4347ec515b3fad (patch)
tree3286587bbeb3ad2fcfb0280b76d696bf401f400b /yarns
parent79d126e6f956b75fc0a8acfffba80f8457bf879d (diff)
downloaddistix-257bfcb994a8cd823376157cea4347ec515b3fad.tar.gz
Add support to import from a Maildir
Diffstat (limited to 'yarns')
-rw-r--r--yarns/080-import-mail.yarn17
-rw-r--r--yarns/900-implements.yarn15
2 files changed, 32 insertions, 0 deletions
diff --git a/yarns/080-import-mail.yarn b/yarns/080-import-mail.yarn
index 7c1e24c..d458deb 100644
--- a/yarns/080-import-mail.yarn
+++ b/yarns/080-import-mail.yarn
@@ -63,6 +63,23 @@ Next, import an mbox.
THEN attempt succeeded
AND output matches "^[0-9a-f]{32} bar$"
+Next, import a Maildir.
+
+ SCENARIO import Maildir
+
+ WHEN user attempts to run distix init REPO
+ THEN attempt succeeded
+
+ GIVEN maildir MAILDIR containing a mail with subject "bar"
+ WHEN user attempts to run distix import-maildir REPO MAILDIR
+ THEN attempt succeeded
+ AND everything in REPO is committed to git
+
+ WHEN user changes working directory to REPO
+ AND user attempts to run distix list
+ THEN attempt succeeded
+ AND output matches "^[0-9a-f]{32} bar$"
+
When importing e-mails, distix needs to automatically recognise when
they belong existing tickets: if the new mail refers to a mail in an
existing ticket, put the new mail to that ticket and don't open a new
diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn
index 221ba9e..d5ca4bf 100644
--- a/yarns/900-implements.yarn
+++ b/yarns/900-implements.yarn
@@ -94,6 +94,21 @@ content.
printf "$MATCH_2" > "$DATADIR/$MATCH_1"
+Maildir creation
+----------------
+
+We need to create a maildir with mails in it.
+
+ IMPLEMENTS GIVEN maildir (\S+) containing a mail with subject "(.+)"
+ dirname="$DATADIR/$MATCH_1"
+ mkdir -p "$dirname/new" "$dirname/cur" "$dirname/tmp"
+ cat <<EOF > "$dirname/new/message"
+ From: user@example.com
+ Subject: $MATCH_2
+
+ Message body goes here.
+ EOF
+
File tests
-----------