summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2019-05-26 18:16:07 -0400
committerDavid Bremner <david@tethera.net>2019-05-29 08:16:58 -0300
commit5007595be89ccd9369973f722af4ecabbd26ad37 (patch)
tree443ccba00a97818848b7020a039b3dc0bee293a5
parent809a34a8708706728e4f1f00367e1dae98cd0d2d (diff)
test: ensure that protected headers appear in notmuch-emacs search as expected
We initially test only notmuch-search; tests for other functionality come in different patchsets later. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
-rwxr-xr-xtest/T358-emacs-protected-headers.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/T358-emacs-protected-headers.sh b/test/T358-emacs-protected-headers.sh
new file mode 100755
index 00000000..56ac06ca
--- /dev/null
+++ b/test/T358-emacs-protected-headers.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+test_description="emacs interface"
+. $(dirname "$0")/test-lib.sh || exit 1
+
+# testing protected headers with emacs
+add_gnupg_home
+add_email_corpus protected-headers
+
+test_begin_subtest "notmuch-search should show not unindexed protected subject header in emacs"
+test_emacs '(notmuch-search "id:protected-header@crypto.notmuchmail.org")
+ (notmuch-test-wait)
+ (test-output)'
+cat <<EOF >EXPECTED
+ 2000-01-01 [1/1] test_suite@notmuchmail.org Subject Unavailable (encrypted inbox unread)
+End of search results.
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+# protected headers should behave differently after re-indexing
+test_begin_subtest 'defaulting to indexing cleartext'
+test_expect_success 'notmuch config set index.decrypt true'
+test_begin_subtest 'try reindexing protected header message'
+test_expect_success 'notmuch reindex id:protected-header@crypto.notmuchmail.org'
+
+test_begin_subtest "notmuch-search should show indexed protected subject header in emacs"
+test_emacs '(notmuch-search "id:protected-header@crypto.notmuchmail.org")
+ (notmuch-test-wait)
+ (test-output)'
+cat <<EOF >EXPECTED
+ 2000-01-01 [1/1] test_suite@notmuchmail.org This is a protected header (encrypted inbox unread)
+End of search results.
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_done