Re: [PATCH v2 1/3] emacs: test notmuch-show during message decryption

2019-05-06 Thread Daniel Kahn Gillmor
On Fri 2019-05-03 17:59:49 +, David Bremner wrote:
> Daniel Kahn Gillmor  writes:
>
>> 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.
>> ---
>>
>> The difference between this and the prior version of the patch is that
>> it updates T357-index-decryption.sh as well, to ensure all tests pass.
>>
>
> I don't _think_ this is gmime3 related, but I get
>
> T357-index-decryption: Testing indexing decrypted mail
>  FAIL   indexing message fails when secret key not available
>   --- T357-index-decryption.31.expected   2019-05-03 17:57:26.701988487 
> +
>   +++ T357-index-decryption.31.output 2019-05-03 17:57:26.701988487 
> +
>   @@ -1,4 +1,4 @@
>#notmuch-dump batch-tag:3 config,properties,tags
>   ++encrypted +inbox +unread -- id:basic-encryp...@crypto.notmuchmail.org
>+encrypted +inbox +unread -- id:simple-encryp...@crypto.notmuchmail.org
>#= simple-encryp...@crypto.notmuchmail.org index.decryption=failure
>   -+encrypted +inbox +unread -- id:basic-encryp...@crypto.notmuchmail.org
>  FAIL   cleartext index recovery on reindexing with stashed session keys
>   --- T357-index-decryption.33.expected   2019-05-03 17:57:26.817988197 
> +
>   +++ T357-index-decryption.33.output 2019-05-03 17:57:26.817988197 
> +
>   @@ -1 +1 @@
>   -thread:0001   2016-12-22 [1/1] Daniel Kahn Gillmor; 
> encrypted message (encrypted inbox unread)
>   +thread:0002   2016-12-22 [1/1] Daniel Kahn Gillmor; 
> encrypted message (encrypted inbox unread)
>
> Applying on top of 103c11822


hm, right, thanks.  The issue here is likely that your filesystem's
readdir puts the messages in the corpus in a different order than mine
does.So these failures are due only to the order in which "notmuch
new" encounters the messages in corpus/crypto.

I'll send a revised patch that should be ordering-independent.  thanks
for catching this!

--dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v2 1/3] emacs: test notmuch-show during message decryption

2019-05-03 Thread David Bremner
Daniel Kahn Gillmor  writes:

> 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.
> ---
>
> The difference between this and the prior version of the patch is that
> it updates T357-index-decryption.sh as well, to ensure all tests pass.
>

I don't _think_ this is gmime3 related, but I get

T357-index-decryption: Testing indexing decrypted mail
 FAIL   indexing message fails when secret key not available
--- T357-index-decryption.31.expected   2019-05-03 17:57:26.701988487 
+
+++ T357-index-decryption.31.output 2019-05-03 17:57:26.701988487 
+
@@ -1,4 +1,4 @@
 #notmuch-dump batch-tag:3 config,properties,tags
++encrypted +inbox +unread -- id:basic-encryp...@crypto.notmuchmail.org
 +encrypted +inbox +unread -- id:simple-encryp...@crypto.notmuchmail.org
 #= simple-encryp...@crypto.notmuchmail.org index.decryption=failure
-+encrypted +inbox +unread -- id:basic-encryp...@crypto.notmuchmail.org
 FAIL   cleartext index recovery on reindexing with stashed session keys
--- T357-index-decryption.33.expected   2019-05-03 17:57:26.817988197 
+
+++ T357-index-decryption.33.output 2019-05-03 17:57:26.817988197 
+
@@ -1 +1 @@
-thread:0001   2016-12-22 [1/1] Daniel Kahn Gillmor; 
encrypted message (encrypted inbox unread)
+thread:0002   2016-12-22 [1/1] Daniel Kahn Gillmor; 
encrypted message (encrypted inbox unread)

Applying on top of 103c11822

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 1/3] emacs: test notmuch-show during message decryption

2019-04-22 Thread Daniel Kahn Gillmor
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.
---

The difference between this and the prior version of the patch is that
it updates T357-index-decryption.sh as well, to ensure all tests pass.

 test/T357-index-decryption.sh |  3 +-
 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, 66 insertions(+), 1 deletion(-)
 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 c5435f4f..e191f6ff 100755
--- a/test/T357-index-decryption.sh
+++ b/test/T357-index-decryption.sh
@@ -236,7 +236,8 @@ notmuch reindex --decrypt=true 
id:simple-encryp...@crypto.notmuchmail.org
 output=$(notmuch dump )
 expected='#notmuch-dump batch-tag:3 config,properties,tags
 +encrypted +inbox +unread -- id:simple-encryp...@crypto.notmuchmail.org
-#= simple-encryp...@crypto.notmuchmail.org index.decryption=failure'
+#= simple-encryp...@crypto.notmuchmail.org index.decryption=failure
++encrypted +inbox +unread -- id:basic-encryp...@crypto.notmuchmail.org'
 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 "
 
+
+# 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-encryp...@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-encryp...@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 ..1ba4698a
--- /dev/null
+++ b/test/corpora/crypto/basic-encrypted.eml
@@ -0,0 +1,28 @@
+From: test_su...@notmuchmail.org
+To: test_su...@notmuchmail.org
+Subject: Here is the password
+Date: Sat, 01 Jan 2000 12:00:00 +
+Message-ID: 
+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 ..08a9e4f6
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-decrypted-message
@@ -0,0 +1,11 @@
+test_su...@notmuchmail.org (2000-01-01) (encrypted inbox)
+Subject: Here is the password
+To: test_su...@notmuchmail.org
+Date: Sat, 01 Jan 2000 12:00:00 +
+
+[ 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 ..530ff286
--- /dev/null
+++ b/test/emacs-show.expected-output/notmuch-show-undecryptable-message
@@ -0,0 +1,10 @@
+Daniel Kahn Gillmor  (2016-12-22) (encrypted inbox)
+Subject: encrypted message
+To: d...@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

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch