Re: [PATCH 1/2] test: add emacs_fcc_message that does not use smtp-dummy
authorMark Walters <markwalters1009@gmail.com>
Sun, 22 Dec 2013 11:39:07 +0000 (11:39 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:58:47 +0000 (09:58 -0800)
cd/88652a64001469554cb6993265da3273567c3c [new file with mode: 0644]

diff --git a/cd/88652a64001469554cb6993265da3273567c3c b/cd/88652a64001469554cb6993265da3273567c3c
new file mode 100644 (file)
index 0000000..fe104e9
--- /dev/null
@@ -0,0 +1,249 @@
+Return-Path: <m.walters@qmul.ac.uk>\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 165AA431FD0\r
+       for <notmuch@notmuchmail.org>; Sun, 22 Dec 2013 03:39:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+       tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+       NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 fPsQKlLr7zb9 for <notmuch@notmuchmail.org>;\r
+       Sun, 22 Dec 2013 03:39:20 -0800 (PST)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id CDD24431FC3\r
+       for <notmuch@notmuchmail.org>; Sun, 22 Dec 2013 03:39:19 -0800 (PST)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+       by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1VuhNI-0002f1-Qv; Sun, 22 Dec 2013 11:39:15 +0000\r
+Received: from 92.41.155.221.threembb.co.uk ([92.41.155.221] helo=localhost)\r
+       by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1VuhNG-0005um-9a; Sun, 22 Dec 2013 11:39:12 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/2] test: add emacs_fcc_message that does not use\r
+       smtp-dummy\r
+In-Reply-To: <1387070158-30547-2-git-send-email-david@tethera.net>\r
+References: <1387070158-30547-1-git-send-email-david@tethera.net>\r
+       <1387070158-30547-2-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.15.2+478~gcd335dc (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Sun, 22 Dec 2013 11:39:07 +0000\r
+Message-ID: <87eh55i084.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 92.41.155.221\r
+X-QM-Geographic: According to ripencc,\r
+       this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record.  :)\r
+X-QM-Body-MD5: 1b4d85c28d30a14b5e8af894535203c0 (of first 20000 bytes)\r
+X-SpamAssassin-Score: 0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+       determine if it is\r
+       spam. We require at least 5.0 points to mark a message as spam.\r
+       This message scored 0.0 points. Summary of the scoring: \r
+       * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+       provider *      (markwalters1009[at]gmail.com)\r
+X-QM-Scan-Virus: ClamAV says the message is clean\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, 22 Dec 2013 11:39:28 -0000\r
+\r
+\r
+Hi\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
+I get a test failure with this patch, but I have a tentative fix. It may\r
+be a mis-configuration in some other part of my setup. \r
+\r
+My computer has a hostname of e4300 (which perhaps should be a FQDN?)\r
+Anyway when running with this patch I get an error for the crypto test\r
+as\r
+\r
+ FAIL   reply to encrypted message\r
+        --- crypto.13.expected  2013-12-22 11:32:24.117104674 +0000\r
+        +++ crypto.13.output    2013-12-22 11:32:24.117104674 +0000\r
+        @@ -1,5 +1,7 @@\r
+         From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
+         Subject: Re: test encrypted message 002\r
+        +       <871u15xgs8.fsf@e4300.i-did-not-set--mail-host-address--so-tickle-me>\r
+        +       <871u15xgs8.fsf@e4300.i-did-not-set--mail-host-address--so-tickle-me>\r
+         \r
+         On 01 Jan 2000 12:00:00 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:\r
+         > This is another test encrypted message.\r
+\r
+If I add the line\r
+\r
+(mail-host-address \"example.com\"))\r
+\r
+inside the let in emacs_fcc_message below then it passes. All tests also\r
+pass on current master.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\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
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r