From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: Notmuch Mail <notmuch@notmuchmail.org>
Subject: [PATCH v3 1/3] emacs: test notmuch-show during message decryption
Date: Mon, 6 May 2019 13:43:27 -0400 [thread overview]
Message-ID: <20190506174327.13457-1-dkg@fifthhorseman.net> (raw)
In-Reply-To: <87imunmu1h.fsf@fifthhorseman.net>
We did not have a test showing what message decryption looks like
within notmuch-emacs. This change gives us a baseline for future work
on the notmuch-emacs interface.
This differs from previous revisions of this patch in that it should
be insensitive to the order in which the local filesystem readdir()s
the underlying maildir.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
test/T357-index-decryption.sh | 13 +++++----
test/T450-emacs-show.sh | 15 ++++++++++
test/corpora/crypto/basic-encrypted.eml | 28 +++++++++++++++++++
.../notmuch-show-decrypted-message | 11 ++++++++
.../notmuch-show-undecryptable-message | 10 +++++++
5 files changed, 71 insertions(+), 6 deletions(-)
create mode 100644 test/corpora/crypto/basic-encrypted.eml
create mode 100644 test/emacs-show.expected-output/notmuch-show-decrypted-message
create mode 100644 test/emacs-show.expected-output/notmuch-show-undecryptable-message
diff --git a/test/T357-index-decryption.sh b/test/T357-index-decryption.sh
index 0a602e50..c9cd5e30 100755
--- a/test/T357-index-decryption.sh
+++ b/test/T357-index-decryption.sh
@@ -224,10 +224,11 @@ add_email_corpus crypto
test_begin_subtest "indexing message fails when secret key not available"
notmuch reindex --decrypt=true id:simple-encrypted@crypto.notmuchmail.org
-output=$(notmuch dump )
-expected='#notmuch-dump batch-tag:3 config,properties,tags
-+encrypted +inbox +unread -- id:simple-encrypted@crypto.notmuchmail.org
-#= simple-encrypted@crypto.notmuchmail.org index.decryption=failure'
+output=$(notmuch dump | LC_ALL=C sort)
+expected='#= simple-encrypted@crypto.notmuchmail.org index.decryption=failure
+#notmuch-dump batch-tag:3 config,properties,tags
++encrypted +inbox +unread -- id:basic-encrypted@crypto.notmuchmail.org
++encrypted +inbox +unread -- id:simple-encrypted@crypto.notmuchmail.org'
test_expect_equal \
"$output" \
"$expected"
@@ -245,8 +246,8 @@ notmuch restore <<EOF
#= simple-encrypted@crypto.notmuchmail.org session-key=9%3AFC09987F5F927CC0CC0EE80A96E4C5BBF4A499818FB591207705DFDDD6112CF9
EOF
notmuch reindex id:simple-encrypted@crypto.notmuchmail.org
-output=$(notmuch search sekrit)
-expected='thread:0000000000000001 2016-12-22 [1/1] Daniel Kahn Gillmor; encrypted message (encrypted inbox unread)'
+output=$(notmuch search sekrit | notmuch_search_sanitize)
+expected='thread:XXX 2016-12-22 [1/1] Daniel Kahn Gillmor; encrypted message (encrypted inbox unread)'
test_expect_equal \
"$output" \
"$expected"
diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index 3555a939..5d4df443 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -208,4 +208,19 @@ test_emacs '(notmuch-show "id:'$gen_msg_id'")
output=$(head -1 OUTPUT.raw|cut -f1-4 -d' ')
test_expect_equal "$output" "Notmuch Test Suite <test_suite@notmuchmail.org>"
+
+# switching to the crypto corpus, using gpg from here on:
+add_gnupg_home
+add_email_corpus crypto
+
+test_begin_subtest "show decrypted message"
+test_emacs '(notmuch-show "id:basic-encrypted@crypto.notmuchmail.org")
+ (test-visible-output)'
+test_expect_equal_file $EXPECTED/notmuch-show-decrypted-message OUTPUT
+
+test_begin_subtest "show undecryptable message"
+test_emacs '(notmuch-show "id:simple-encrypted@crypto.notmuchmail.org")
+ (test-visible-output)'
+test_expect_equal_file $EXPECTED/notmuch-show-undecryptable-message OUTPUT
+
test_done
diff --git a/test/corpora/crypto/basic-encrypted.eml b/test/corpora/crypto/basic-encrypted.eml
new file mode 100644
index 00000000..1ba4698a
--- /dev/null
+++ b/test/corpora/crypto/basic-encrypted.eml
@@ -0,0 +1,28 @@
+From: test_suite@notmuchmail.org
+To: test_suite@notmuchmail.org
+Subject: Here is the password
+Date: Sat, 01 Jan 2000 12:00:00 +0000
+Message-ID: <basic-encrypted@crypto.notmuchmail.org>
+MIME-Version: 1.0
+Content-Type: multipart/encrypted; boundary="=-=-=";
+ protocol="application/pgp-encrypted"
+
+--=-=-=
+Content-Type: application/pgp-encrypted
+
+Version: 1
+
+--=-=-=
+Content-Type: application/octet-stream
+
+-----BEGIN PGP MESSAGE-----
+
+hIwDxE023q1UqxYBBACp70e7KPy9OYaheIrkLzmhq1lRqmy51aL1jBL0K/qN7rfK
+BZEG1cR8jeLjTFdPKPLVKJI80r7FgKI0ywvWvl6R1aE1Ty5BnVXT9XzCrEH7fqCl
+SKK82EvolXTohAZHUrh6K66eQQTTIAC1n7B0A8hErzkgaM4+seN3LlvezT6TLNKM
+ATpqsEbM2MVrGgw0b3oUsGGAPEt2MmjNEYsriKnqwt6dJDZc//XyhjgMQayiD8da
+N1gT3oqgu/gKCpBZDYzHf9OtVi2UnlFDWy6rrMZLjWDnIv4ve9Pn/qolwHVjzdJ1
+ZfjNC5t0z3XADKGrjN9wutr4qm7STW1rHAXHP68TQTxI0qgJKjPXNKWEw6g=
+=pJG4
+-----END PGP MESSAGE-----
+--=-=-=--
diff --git a/test/emacs-show.expected-output/notmuch-show-decrypted-message b/test/emacs-show.expected-output/notmuch-show-decrypted-message
new file mode 100644
index 00000000..08a9e4f6
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-decrypted-message
@@ -0,0 +1,11 @@
+test_suite@notmuchmail.org (2000-01-01) (encrypted inbox)
+Subject: Here is the password
+To: test_suite@notmuchmail.org
+Date: Sat, 01 Jan 2000 12:00:00 +0000
+
+[ multipart/encrypted ]
+[ Decryption successful ]
+[ Unknown signature status ]
+[ application/pgp-encrypted ]
+[ text/plain ]
+The password is "abcd1234!", please do not tell anyone.
diff --git a/test/emacs-show.expected-output/notmuch-show-undecryptable-message b/test/emacs-show.expected-output/notmuch-show-undecryptable-message
new file mode 100644
index 00000000..530ff286
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-undecryptable-message
@@ -0,0 +1,10 @@
+Daniel Kahn Gillmor <dkg@fifthhorseman.net> (2016-12-22) (encrypted inbox)
+Subject: encrypted message
+To: dkg@fifthhorseman.net
+Date: Thu, 22 Dec 2016 08:34:56 -0400
+
+[ multipart/encrypted ]
+[ Decryption error ]
+[ Unknown signature status ]
+[ application/pgp-encrypted ]
+[ application/octet-stream ]
--
2.20.1
next prev parent reply other threads:[~2019-05-06 17:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-22 17:18 [PATCH 1/3] emacs: test notmuch-show during message decryption Daniel Kahn Gillmor
2019-04-22 17:18 ` [PATCH 2/3] test: show what emacs sees of an encrypted message when crypto is disabled Daniel Kahn Gillmor
2019-05-10 15:33 ` David Bremner
2019-04-22 17:18 ` [PATCH 3/3] emacs: Drop content-free "Unknown signature status" button Daniel Kahn Gillmor
2019-04-22 17:26 ` Daniel Kahn Gillmor
2019-04-23 16:18 ` Daniel Kahn Gillmor
2019-05-20 3:16 ` Daniel Kahn Gillmor
2019-05-24 1:13 ` David Bremner
2019-05-24 19:21 ` Daniel Kahn Gillmor
2019-05-25 1:38 ` David Bremner
2019-05-25 14:23 ` Daniel Kahn Gillmor
2019-05-25 16:40 ` David Bremner
2019-04-22 21:07 ` [PATCH v2 1/3] emacs: test notmuch-show during message decryption Daniel Kahn Gillmor
2019-05-03 17:59 ` David Bremner
2019-05-06 16:23 ` Daniel Kahn Gillmor
2019-05-06 17:43 ` Daniel Kahn Gillmor [this message]
2019-05-10 10:17 ` [PATCH v3 " David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190506174327.13457-1-dkg@fifthhorseman.net \
--to=dkg@fifthhorseman.net \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).