]> git.notmuchmail.org Git - notmuch/blobdiff - test/T630-emacs-draft.sh
Use `without-restriction` in `with-temporary-notmuch-message-buffer`
[notmuch] / test / T630-emacs-draft.sh
index 46fc356f7e6ce68cabc67f0e0ec8a0a92ea7c8bf..1fad58a813bd3a151f3a617397d64c46358aec63 100755 (executable)
@@ -1,7 +1,9 @@
 #!/usr/bin/env bash
 test_description="Emacs Draft Handling"
-. ./test-lib.sh || exit 1
+. $(dirname "$0")/test-lib.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
 
+test_require_emacs
 add_email_corpus
 
 notmuch config set search.exclude_tags deleted
@@ -32,7 +34,9 @@ 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)
+            ;; We would use (mml-secure-message-sign) but on emacs23
+            ;; that only signs the part, not the whole message.
+            (mml-secure-message mml-secure-method '\''sign)
            (notmuch-draft-save)
            (test-output)'
 header_count=$(notmuch show --format=raw subject:draft-test-0003 | grep -c ^X-Notmuch-Emacs-Secure)
@@ -67,4 +71,36 @@ Fcc: MAIL_DIR/sent
 <#secure method=pgpmime mode=sign>
 EOF
 test_expect_equal_file EXPECTED OUTPUT.clean
+
+add_email_corpus attachment
+test_begin_subtest "Saving a draft keeps hidden headers"
+test_emacs '(notmuch-mua-new-reply "id:874llc2bkp.fsf@curie.anarc.at")
+            (message-goto-subject)
+            (delete-line)
+            (insert "Subject: draft-test-reply\n")
+           (test-output "DRAFT")
+           (notmuch-draft-postpone)
+           (notmuch-show "subject:draft-test-reply")
+           (notmuch-show-resume-message)
+           (test-output)'
+notmuch_dir_sanitize OUTPUT > OUTPUT.clean
+
+cat <<EOF > EXPECTED
+References: <87d10042pu.fsf@curie.anarc.at> <87woy8vx7i.fsf@tesseract.cs.unb.ca> <87a7v42bv9.fsf@curie.anarc.at> <874llc2bkp.fsf@curie.anarc.at>
+From: Notmuch Test Suite <test_suite@notmuchmail.org>
+To: Antoine Beaupré <anarcat@orangeseeds.org>
+Subject: draft-test-reply
+In-Reply-To: <874llc2bkp.fsf@curie.anarc.at>
+Fcc: MAIL_DIR/sent
+--text follows this line--
+Antoine Beaupré <anarcat@orangeseeds.org> writes:
+
+> And obviously I forget the frigging attachment.
+>
+>
+> PS: don't we have a "you forgot to actually attach the damn file" plugin
+> when we detect the word "attachment" and there's no attach? :p
+EOF
+test_expect_equal_file EXPECTED OUTPUT.clean
+
 test_done