[PATCH 1/3] test: emacs: add subtest "Send reply from within Emacs"

Pieter Praet pieter at praet.org
Fri May 13 08:07:48 PDT 2011


Renamed subtest "Reply within emacs" to "Compose reply in emacs" as it
doesn't really "do" a reply, but rather populates a reply buffer and
then princ's it.

... and couldn't possibly justify that without writing an actual reply test.

Signed-off-by: Pieter Praet <pieter at praet.org>
---
 test/emacs |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/test/emacs b/test/emacs
index 3264bf2..18d8322 100755
--- a/test/emacs
+++ b/test/emacs
@@ -99,7 +99,7 @@ notmuch new > /dev/null
 output=$(notmuch search 'subject:"testing message sent via SMTP"' | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   1974-03-29 [1/1] Notmuch Test Suite; Testing message sent via SMTP (inbox)"
 
-test_begin_subtest "Reply within emacs"
+test_begin_subtest "Compose reply in emacs"
 # We sed away everything before the ^From in the output to avoid getting
 # confused by messages such as "Parsing /home/cworth/.mailrc... done"
 output=$(test_emacs '(notmuch-search "subject:\"testing message sent via SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) (princ (buffer-string))' | sed -ne '/^From/,$ p' | sed -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/')
@@ -112,6 +112,37 @@ Fcc: $(pwd)/mail/sent
 On Fri, 29 Mar 1974 10:00:00 -0000, Notmuch Test Suite <test_suite at notmuchmail.org> wrote:
 > This is a test that messages are sent via SMTP"
 
+
+test_begin_subtest "Send reply from within Emacs"
+../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-search "subject:\"testing message sent via SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) (message-goto-to) (message-goto-body) (end-of-buffer) (newline) (insert "Reply to a message via Emacs with fake SMTP") (message-send-and-exit)' >/dev/null 2>&1
+wait ${smtp_dummy_pid}
+
+output=$(sed \
+    -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' \
+    -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' \
+    -e s',^In-Reply-To: <.*>$,In-Reply-To: <XXX>,' \
+    -e s',^References: <.*>$,References: <XXX>,' \
+    -e s',^Date: .*$,Date: Fri\, 29 Mar 1974 10:05:00 -0000,' < sent_message)
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite at notmuchmail.org>
+To: user at example.com
+Subject: Re: Testing message sent via SMTP
+In-Reply-To: <XXX>
+References: <XXX>
+User-Agent: Notmuch/XXX Emacs/XXX
+Date: Fri, 29 Mar 1974 10:05:00 -0000
+Message-ID: <XXX>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=us-ascii
+
+On Fri, 29 Mar 1974 10:00:00 -0000, Notmuch Test Suite <test_suite at notmuchmail.org> wrote:
+> This is a test that messages are sent via SMTP
+
+Reply to a message via Emacs with fake SMTP"
+
+
 test_begin_subtest "Save attachment from within emacs"
 echo "./attachment" | test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com") (notmuch-show-save-attachments)' > /dev/null 2>&1
 output=$(cat attachment)
-- 
1.7.4.1



More information about the notmuch mailing list