aboutsummaryrefslogtreecommitdiff
path: root/test/T630-emacs-draft.sh
diff options
context:
space:
mode:
authorMark Walters <markwalters1009@gmail.com>2016-11-13 14:08:48 +0000
committerDavid Bremner <david@tethera.net>2016-11-13 12:55:24 -0400
commitd820b97477f5705640aa8dcf9dcf311e37508def (patch)
treeacc91875ce9c3b54892414ee248b46403892b55c /test/T630-emacs-draft.sh
parentf8bdba37d3f4c877e05e17b5b1c7d2d512106538 (diff)
emacs: postpone a message
This provides initial support for postponing in the emacs frontend; resuming will follow in a later commit. On saving/postponing it uses notmuch insert to put the message in the notmuch database Current bindings are C-x C-s to save a draft, C-c C-p to postpone a draft (save and exit compose buffer). Previous drafts get tagged deleted on subsequent saves, or on the message being sent. Each draft gets its own message-id, and we use the namespace draft-.... for draft message ids (so, at least for most people, drafts are easily distinguisable).
Diffstat (limited to 'test/T630-emacs-draft.sh')
-rwxr-xr-xtest/T630-emacs-draft.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/T630-emacs-draft.sh b/test/T630-emacs-draft.sh
new file mode 100755
index 00000000..e39690ca
--- /dev/null
+++ b/test/T630-emacs-draft.sh
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+test_description="Emacs Draft Handling"
+. ./test-lib.sh || exit 1
+
+add_email_corpus
+
+notmuch config set search.exclude_tags deleted
+
+test_begin_subtest "Saving a draft indexes it"
+test_emacs '(notmuch-mua-mail)
+ (message-goto-subject)
+ (insert "draft-test-0001")
+ (notmuch-draft-save)
+ (test-output)'
+count1=$(notmuch count tag:draft)
+count2=$(notmuch count subject:draft-test-0001)
+test_expect_equal "$count1=$count2" "1=1"
+
+test_begin_subtest "Saving a draft tags previous draft as deleted"
+test_emacs '(notmuch-mua-mail)
+ (message-goto-subject)
+ (insert "draft-test-0002")
+ (notmuch-draft-save)
+ (notmuch-draft-save)
+ (test-output)'
+count1=$(notmuch count tag:draft)
+count2=$(notmuch count subject:draft-test-0002)
+
+test_expect_equal "$count1,$count2" "2,1"
+
+test_begin_subtest "Saving a signed draft adds header"
+test_emacs '(notmuch-mua-mail)
+ (message-goto-subject)
+ (insert "draft-test-0003")
+ (mml-secure-message-sign)
+ (notmuch-draft-save)
+ (test-output)'
+header_count=$(notmuch show --format=raw subject:draft-test-0003 | grep -c ^X-Notmuch-Emacs-Secure)
+body_count=$(notmuch notmuch show --format=raw subject:draft-test-0003 | grep -c '^\<#secure')
+test_expect_equal "$header_count,$body_count" "1,0"
+
+test_done