diff options
author | Jameson Graef Rollins <jrollins@finestructure.net> | 2011-05-25 18:01:16 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2011-05-27 16:22:00 -0700 |
commit | 627d752501b42326b9016271de33a6cb0fa2dc8c (patch) | |
tree | 0fb20d089b6debef1f79ae120573f23662b4baff /test/test-lib.sh | |
parent | 18967ef7506566c3b7b5332893a3876da051ca5d (diff) |
test: add crypto tests for signature verification and decryption
This adds a new "crypto" test script to the test suite to test
PGP/MIME signature verification and message decryption. Included here
is a test GNUPGHOME with a test secret key (passwordless), and test
for:
* signing/verification
* signing/verification with full owner trust
* verification with signer key unavailable
* encryption/decryption
* decryption failure with missing key
* encryption/decryption + signing/verfifying
* reply to encrypted message
* verification of signature from revoked key
These tests are not expected to pass now, but will as crypto
functionality is included.
Diffstat (limited to 'test/test-lib.sh')
-rwxr-xr-x | test/test-lib.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh index 078f060..922b1ef 100755 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -379,6 +379,26 @@ add_message () notmuch new > /dev/null } +# Deliver a message with emacs and add it to the database +# +# Uses emacs to generate and deliver a message to the mail store. +# Accepts arbitrary extra emacs/elisp functions to modify the message +# before sending, which is useful to doing things like attaching files +# to the message and encrypting/signing. +emacs_deliver_message () +{ + local subject="$1" + local body="$2" + shift 2 + # before we can send a message, we have to prepare the FCC maildir + mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp} + ../smtp-dummy sent_message & + smtp_dummy_pid=$! + test_emacs "(setq message-send-mail-function 'message-smtpmail-send-it) (setq smtpmail-smtp-server \"localhost\") (setq smtpmail-smtp-service \"25025\") (notmuch-hello) (notmuch-mua-mail) (message-goto-to) (insert \"test_suite@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 -0000\") (message-goto-subject) (insert \"${subject}\") (message-goto-body) (insert \"${body}\") $@ (message-send-and-exit)" >/dev/null 2>&1 + wait ${smtp_dummy_pid} + notmuch new >/dev/null +} + # Generate a corpus of email and add it to the database. # # This corpus is fixed, (it happens to be 50 messages from early in @@ -509,6 +529,14 @@ notmuch_show_sanitize_all () -e 's| id:[^ ]* | id:XXXXX |' } +notmuch_json_show_sanitize () +{ + sed -e 's|, |,\n |g' | \ + sed \ + -e 's|"id": "[^"]*",|"id": "XXXXX",|' \ + -e 's|"filename": "[^"]*",|"filename": "YYYYY",|' +} + # End of notmuch helper functions # Use test_set_prereq to tell that a particular prerequisite is available. @@ -946,6 +974,7 @@ rm -fr "$test" || { } MAIL_DIR="${TMP_DIRECTORY}/mail" +export GNUPGHOME="${TMP_DIRECTORY}/gnupg" export NOTMUCH_CONFIG="${TMP_DIRECTORY}/notmuch-config" mkdir -p "${test}" |