diff options
author | David Bremner <david@tethera.net> | 2013-12-14 22:39:54 +0800 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2013-12-22 20:44:44 +0800 |
commit | 513a36d105995c327c23fec5f60ea70c65b986dd (patch) | |
tree | 51e0f273e07c37a003c7651ac071474d9c876a2b /test/test-lib.sh | |
parent | b421f00a05dba82d6c3df6dcb6ae9063c5395b49 (diff) |
test: add emacs_fcc_message that does not use smtp-dummy
Most of the tests previously using emacs_deliver_message do not use
the actual transmitted message, so we replace it with a simpler (and
presumably more reliable function) that only saves (and indexes) an
fcc copy of the message.
Diffstat (limited to 'test/test-lib.sh')
-rw-r--r-- | test/test-lib.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh index 53cb9475..be0c133b 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -470,6 +470,36 @@ emacs_deliver_message () notmuch new >/dev/null } +# Pretend to deliver a message with emacs. Really save it to a file +# 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_fcc_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} + + test_emacs \ + "(let ((message-send-mail-function (lambda () t)) + (mail-host-address \"example.com\")) + (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))" || return 1 + 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 |