test: Use an explicit date in the message sent via (fake) SMTP

Simply setting an explicit date is cleaner than letting the current,
(arbitrary), date get generated for the email message and then constantly
filtering that date out of search results.
This commit is contained in:
Carl Worth 2010-10-27 17:06:26 -07:00
parent 36dcbdeff6
commit 7123e63b00

View file

@ -65,18 +65,17 @@ mkdir -p mail/sent/tmp
../smtp-dummy sent_message & ../smtp-dummy sent_message &
smtp_dummy_pid=$! 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 \"user@example.com\") (message-goto-subject) (insert \"Testing message sent via SMTP\") (message-goto-body) (insert \"This is a test that messages are sent via SMTP\") (message-send-and-exit)" >/dev/null 2>&1 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 \"user@example.com\nDate: Fri, 29 Mar 1974 10:00:00 -0000\") (message-goto-subject) (insert \"Testing message sent via SMTP\") (message-goto-body) (insert \"This is a test that messages are sent via SMTP\") (message-send-and-exit)" >/dev/null 2>&1
wait ${smtp_dummy_pid} wait ${smtp_dummy_pid}
output=$(sed \ output=$(sed \
-e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' \ -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' \
-e s',^Date:.*,Date: XXX,' \
-e s',^Message-ID: <.*>$,Message-ID: <XXX>,' < sent_message) -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' < sent_message)
test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org> test_expect_equal "$output" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
To: user@example.com To: user@example.com
Subject: Testing message sent via SMTP Subject: Testing message sent via SMTP
Date: Fri, 29 Mar 1974 10:00:00 -0000
User-Agent: Notmuch/XXX Emacs/XXX User-Agent: Notmuch/XXX Emacs/XXX
Date: XXX
Message-ID: <XXX> Message-ID: <XXX>
MIME-Version: 1.0 MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii Content-Type: text/plain; charset=us-ascii