mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
emacs: test notmuch-show during message decryption
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>
This commit is contained in:
parent
eeff431996
commit
e1c8357c44
5 changed files with 71 additions and 6 deletions
|
@ -224,10 +224,11 @@ add_email_corpus crypto
|
||||||
|
|
||||||
test_begin_subtest "indexing message fails when secret key not available"
|
test_begin_subtest "indexing message fails when secret key not available"
|
||||||
notmuch reindex --decrypt=true id:simple-encrypted@crypto.notmuchmail.org
|
notmuch reindex --decrypt=true id:simple-encrypted@crypto.notmuchmail.org
|
||||||
output=$(notmuch dump )
|
output=$(notmuch dump | LC_ALL=C sort)
|
||||||
expected='#notmuch-dump batch-tag:3 config,properties,tags
|
expected='#= simple-encrypted@crypto.notmuchmail.org index.decryption=failure
|
||||||
+encrypted +inbox +unread -- id:simple-encrypted@crypto.notmuchmail.org
|
#notmuch-dump batch-tag:3 config,properties,tags
|
||||||
#= simple-encrypted@crypto.notmuchmail.org index.decryption=failure'
|
+encrypted +inbox +unread -- id:basic-encrypted@crypto.notmuchmail.org
|
||||||
|
+encrypted +inbox +unread -- id:simple-encrypted@crypto.notmuchmail.org'
|
||||||
test_expect_equal \
|
test_expect_equal \
|
||||||
"$output" \
|
"$output" \
|
||||||
"$expected"
|
"$expected"
|
||||||
|
@ -245,8 +246,8 @@ notmuch restore <<EOF
|
||||||
#= simple-encrypted@crypto.notmuchmail.org session-key=9%3AFC09987F5F927CC0CC0EE80A96E4C5BBF4A499818FB591207705DFDDD6112CF9
|
#= simple-encrypted@crypto.notmuchmail.org session-key=9%3AFC09987F5F927CC0CC0EE80A96E4C5BBF4A499818FB591207705DFDDD6112CF9
|
||||||
EOF
|
EOF
|
||||||
notmuch reindex id:simple-encrypted@crypto.notmuchmail.org
|
notmuch reindex id:simple-encrypted@crypto.notmuchmail.org
|
||||||
output=$(notmuch search sekrit)
|
output=$(notmuch search sekrit | notmuch_search_sanitize)
|
||||||
expected='thread:0000000000000001 2016-12-22 [1/1] Daniel Kahn Gillmor; encrypted message (encrypted inbox unread)'
|
expected='thread:XXX 2016-12-22 [1/1] Daniel Kahn Gillmor; encrypted message (encrypted inbox unread)'
|
||||||
test_expect_equal \
|
test_expect_equal \
|
||||||
"$output" \
|
"$output" \
|
||||||
"$expected"
|
"$expected"
|
||||||
|
|
|
@ -208,4 +208,19 @@ test_emacs '(notmuch-show "id:'$gen_msg_id'")
|
||||||
output=$(head -1 OUTPUT.raw|cut -f1-4 -d' ')
|
output=$(head -1 OUTPUT.raw|cut -f1-4 -d' ')
|
||||||
test_expect_equal "$output" "Notmuch Test Suite <test_suite@notmuchmail.org>"
|
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
|
test_done
|
||||||
|
|
28
test/corpora/crypto/basic-encrypted.eml
Normal file
28
test/corpora/crypto/basic-encrypted.eml
Normal file
|
@ -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-----
|
||||||
|
--=-=-=--
|
|
@ -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.
|
|
@ -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 ]
|
Loading…
Reference in a new issue