--- /dev/null
+Return-Path: <bremner@tesseract.cs.unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 50786431FD0\r
+ for <notmuch@notmuchmail.org>; Sat, 14 Dec 2013 17:16:41 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id h8-zTsqkiWK5 for <notmuch@notmuchmail.org>;\r
+ Sat, 14 Dec 2013 17:16:35 -0800 (PST)\r
+Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id BED8D431FD5\r
+ for <notmuch@notmuchmail.org>; Sat, 14 Dec 2013 17:16:25 -0800 (PST)\r
+Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
+ (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1Vs0Jj-0000Si-8t; Sat, 14 Dec 2013 21:16:23 -0400\r
+Received: (nullmailer pid 13656 invoked by uid 1000); Sun, 15 Dec 2013\r
+ 01:16:11 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] test: add emacs_fcc_message that does not use smtp-dummy\r
+Date: Sun, 15 Dec 2013 09:15:57 +0800\r
+Message-Id: <1387070158-30547-2-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.8.4.3\r
+In-Reply-To: <1387070158-30547-1-git-send-email-david@tethera.net>\r
+References: <1387070158-30547-1-git-send-email-david@tethera.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 15 Dec 2013 01:16:41 -0000\r
+\r
+Most of the tests previously using emacs_deliver_message do not use\r
+the actual transmitted message, so we replace it with a simpler (and\r
+presumably more reliable function) that only saves (and indexes) an\r
+fcc copy of the message.\r
+---\r
+ test/crypto | 10 +++-------\r
+ test/emacs | 4 ++--\r
+ test/json | 2 +-\r
+ test/sexp | 2 +-\r
+ test/test-lib.sh | 29 +++++++++++++++++++++++++++++\r
+ 5 files changed, 36 insertions(+), 11 deletions(-)\r
+\r
+diff --git a/test/crypto b/test/crypto\r
+index 9e5ff4f..477b397 100755\r
+--- a/test/crypto\r
++++ b/test/crypto\r
+@@ -28,12 +28,8 @@ add_gnupg_home\r
+ # get key fingerprint\r
+ FINGERPRINT=$(gpg --no-tty --list-secret-keys --with-colons --fingerprint | grep '^fpr:' | cut -d: -f10)\r
+ \r
+-# for some reason this is needed for emacs_deliver_message to work,\r
+-# although I can't figure out why\r
+-add_email_corpus\r
+-\r
+ test_expect_success 'emacs delivery of signed message' \\r
+-'emacs_deliver_message \\r
++'emacs_fcc_message \\r
+ "test signed message 001" \\r
+ "This is a test signed message." \\r
+ "(mml-secure-message-sign)"'\r
+@@ -143,7 +139,7 @@ cat <<EOF >TESTATTACHMENT\r
+ This is a test file.\r
+ EOF\r
+ test_expect_success 'emacs delivery of encrypted message with attachment' \\r
+-'emacs_deliver_message \\r
++'emacs_fcc_message \\r
+ "test encrypted message 001" \\r
+ "This is a test encrypted message.\n" \\r
+ "(mml-attach-file \"TESTATTACHMENT\") (mml-secure-message-encrypt)"'\r
+@@ -270,7 +266,7 @@ test_expect_equal_json \\r
+ mv "${GNUPGHOME}"{.bak,}\r
+ \r
+ test_expect_success 'emacs delivery of encrypted + signed message' \\r
+-'emacs_deliver_message \\r
++'emacs_fcc_message \\r
+ "test encrypted message 002" \\r
+ "This is another test encrypted message.\n" \\r
+ "(mml-secure-message-sign-encrypt)"'\r
+diff --git a/test/emacs b/test/emacs\r
+index 1b1ebe3..863219d 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -771,7 +771,7 @@ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+ test_begin_subtest "Do not call notmuch for non-inlinable application/mpeg parts"\r
+ id='message-with-application/mpeg-attachment@notmuchmail.org'\r
+-emacs_deliver_message \\r
++emacs_fcc_message \\r
+ 'Message with application/mpeg attachment' \\r
+ '' \\r
+ "(message-goto-eoh)\r
+@@ -786,7 +786,7 @@ test_expect_equal $(notmuch_counter_value) 1\r
+ \r
+ test_begin_subtest "Do not call notmuch for non-inlinable audio/mpeg parts"\r
+ id='message-with-audio/mpeg-attachment@notmuchmail.org'\r
+-emacs_deliver_message \\r
++emacs_fcc_message \\r
+ 'Message with audio/mpeg attachment' \\r
+ '' \\r
+ "(message-goto-eoh)\r
+diff --git a/test/json b/test/json\r
+index e07a290..c1cf649 100755\r
+--- a/test/json\r
++++ b/test/json\r
+@@ -38,7 +38,7 @@ test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true\r
+ test_begin_subtest "Show message: json, inline attachment filename"\r
+ subject='json-show-inline-attachment-filename'\r
+ id="json-show-inline-attachment-filename@notmuchmail.org"\r
+-emacs_deliver_message \\r
++emacs_fcc_message \\r
+ "$subject" \\r
+ 'This is a test message with inline attachment with a filename' \\r
+ "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")\r
+diff --git a/test/sexp b/test/sexp\r
+index be815e1..667e319 100755\r
+--- a/test/sexp\r
++++ b/test/sexp\r
+@@ -29,7 +29,7 @@ test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :f\r
+ test_begin_subtest "Show message: sexp, inline attachment filename"\r
+ subject='sexp-show-inline-attachment-filename'\r
+ id="sexp-show-inline-attachment-filename@notmuchmail.org"\r
+-emacs_deliver_message \\r
++emacs_fcc_message \\r
+ "$subject" \\r
+ 'This is a test message with inline attachment with a filename' \\r
+ "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\")\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 53cb947..66c0720 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -470,6 +470,35 @@ emacs_deliver_message ()\r
+ notmuch new >/dev/null\r
+ }\r
+ \r
++# Pretend to deliver a message with emacs. Really save it to a file\r
++# and add it to the database\r
++#\r
++# Uses emacs to generate and deliver a message to the mail store.\r
++# Accepts arbitrary extra emacs/elisp functions to modify the message\r
++# before sending, which is useful to doing things like attaching files\r
++# to the message and encrypting/signing.\r
++emacs_fcc_message ()\r
++{\r
++ local subject="$1"\r
++ local body="$2"\r
++ shift 2\r
++ # before we can send a message, we have to prepare the FCC maildir\r
++ mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp}\r
++\r
++ test_emacs \\r
++ "(let ((message-send-mail-function (lambda () t)))\r
++ (notmuch-mua-mail)\r
++ (message-goto-to)\r
++ (insert \"test_suite@notmuchmail.org\nDate: 01 Jan 2000 12:00:00 -0000\")\r
++ (message-goto-subject)\r
++ (insert \"${subject}\")\r
++ (message-goto-body)\r
++ (insert \"${body}\")\r
++ $@\r
++ (message-send-and-exit))" || return 1\r
++ notmuch new >/dev/null\r
++}\r
++\r
+ # Generate a corpus of email and add it to the database.\r
+ #\r
+ # This corpus is fixed, (it happens to be 50 messages from early in\r
+-- \r
+1.8.4.3\r
+\r