From 50df732dfb5de9a57ba8ab523321485d8460b97c Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sun, 22 Dec 2013 11:39:07 +0000 Subject: [PATCH] Re: [PATCH 1/2] test: add emacs_fcc_message that does not use smtp-dummy --- cd/88652a64001469554cb6993265da3273567c3c | 249 ++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 cd/88652a64001469554cb6993265da3273567c3c diff --git a/cd/88652a64001469554cb6993265da3273567c3c b/cd/88652a64001469554cb6993265da3273567c3c new file mode 100644 index 000000000..fe104e97e --- /dev/null +++ b/cd/88652a64001469554cb6993265da3273567c3c @@ -0,0 +1,249 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 165AA431FD0 + for ; Sun, 22 Dec 2013 03:39:28 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id fPsQKlLr7zb9 for ; + Sun, 22 Dec 2013 03:39:20 -0800 (PST) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id CDD24431FC3 + for ; Sun, 22 Dec 2013 03:39:19 -0800 (PST) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1VuhNI-0002f1-Qv; Sun, 22 Dec 2013 11:39:15 +0000 +Received: from 92.41.155.221.threembb.co.uk ([92.41.155.221] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1VuhNG-0005um-9a; Sun, 22 Dec 2013 11:39:12 +0000 +From: Mark Walters +To: David Bremner , notmuch@notmuchmail.org +Subject: Re: [PATCH 1/2] test: add emacs_fcc_message that does not use + smtp-dummy +In-Reply-To: <1387070158-30547-2-git-send-email-david@tethera.net> +References: <1387070158-30547-1-git-send-email-david@tethera.net> + <1387070158-30547-2-git-send-email-david@tethera.net> +User-Agent: Notmuch/0.15.2+478~gcd335dc (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Sun, 22 Dec 2013 11:39:07 +0000 +Message-ID: <87eh55i084.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 92.41.155.221 +X-QM-Geographic: According to ripencc, + this message was delivered by a machine in Britain (UK) (GB). +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 1b4d85c28d30a14b5e8af894535203c0 (of first 20000 bytes) +X-SpamAssassin-Score: 0.0 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored 0.0 points. Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) +X-QM-Scan-Virus: ClamAV says the message is clean +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 22 Dec 2013 11:39:28 -0000 + + +Hi + +> 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. + +I get a test failure with this patch, but I have a tentative fix. It may +be a mis-configuration in some other part of my setup. + +My computer has a hostname of e4300 (which perhaps should be a FQDN?) +Anyway when running with this patch I get an error for the crypto test +as + + FAIL reply to encrypted message + --- crypto.13.expected 2013-12-22 11:32:24.117104674 +0000 + +++ crypto.13.output 2013-12-22 11:32:24.117104674 +0000 + @@ -1,5 +1,7 @@ + From: Notmuch Test Suite + Subject: Re: test encrypted message 002 + + <871u15xgs8.fsf@e4300.i-did-not-set--mail-host-address--so-tickle-me> + + <871u15xgs8.fsf@e4300.i-did-not-set--mail-host-address--so-tickle-me> + + On 01 Jan 2000 12:00:00 -0000, Notmuch Test Suite wrote: + > This is another test encrypted message. + +If I add the line + +(mail-host-address \"example.com\")) + +inside the let in emacs_fcc_message below then it passes. All tests also +pass on current master. + +Best wishes + +Mark + + + +> test/crypto | 10 +++------- +> test/emacs | 4 ++-- +> test/json | 2 +- +> test/sexp | 2 +- +> test/test-lib.sh | 29 +++++++++++++++++++++++++++++ +> 5 files changed, 36 insertions(+), 11 deletions(-) +> +> diff --git a/test/crypto b/test/crypto +> index 9e5ff4f..477b397 100755 +> --- a/test/crypto +> +++ b/test/crypto +> @@ -28,12 +28,8 @@ add_gnupg_home +> # get key fingerprint +> FINGERPRINT=$(gpg --no-tty --list-secret-keys --with-colons --fingerprint | grep '^fpr:' | cut -d: -f10) +> +> -# for some reason this is needed for emacs_deliver_message to work, +> -# although I can't figure out why +> -add_email_corpus +> - +> test_expect_success 'emacs delivery of signed message' \ +> -'emacs_deliver_message \ +> +'emacs_fcc_message \ +> "test signed message 001" \ +> "This is a test signed message." \ +> "(mml-secure-message-sign)"' +> @@ -143,7 +139,7 @@ cat <TESTATTACHMENT +> This is a test file. +> EOF +> test_expect_success 'emacs delivery of encrypted message with attachment' \ +> -'emacs_deliver_message \ +> +'emacs_fcc_message \ +> "test encrypted message 001" \ +> "This is a test encrypted message.\n" \ +> "(mml-attach-file \"TESTATTACHMENT\") (mml-secure-message-encrypt)"' +> @@ -270,7 +266,7 @@ test_expect_equal_json \ +> mv "${GNUPGHOME}"{.bak,} +> +> test_expect_success 'emacs delivery of encrypted + signed message' \ +> -'emacs_deliver_message \ +> +'emacs_fcc_message \ +> "test encrypted message 002" \ +> "This is another test encrypted message.\n" \ +> "(mml-secure-message-sign-encrypt)"' +> diff --git a/test/emacs b/test/emacs +> index 1b1ebe3..863219d 100755 +> --- a/test/emacs +> +++ b/test/emacs +> @@ -771,7 +771,7 @@ test_expect_equal_file OUTPUT EXPECTED +> +> test_begin_subtest "Do not call notmuch for non-inlinable application/mpeg parts" +> id='message-with-application/mpeg-attachment@notmuchmail.org' +> -emacs_deliver_message \ +> +emacs_fcc_message \ +> 'Message with application/mpeg attachment' \ +> '' \ +> "(message-goto-eoh) +> @@ -786,7 +786,7 @@ test_expect_equal $(notmuch_counter_value) 1 +> +> test_begin_subtest "Do not call notmuch for non-inlinable audio/mpeg parts" +> id='message-with-audio/mpeg-attachment@notmuchmail.org' +> -emacs_deliver_message \ +> +emacs_fcc_message \ +> 'Message with audio/mpeg attachment' \ +> '' \ +> "(message-goto-eoh) +> diff --git a/test/json b/test/json +> index e07a290..c1cf649 100755 +> --- a/test/json +> +++ b/test/json +> @@ -38,7 +38,7 @@ test_expect_equal_json "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true +> test_begin_subtest "Show message: json, inline attachment filename" +> subject='json-show-inline-attachment-filename' +> id="json-show-inline-attachment-filename@notmuchmail.org" +> -emacs_deliver_message \ +> +emacs_fcc_message \ +> "$subject" \ +> 'This is a test message with inline attachment with a filename' \ +> "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\") +> diff --git a/test/sexp b/test/sexp +> index be815e1..667e319 100755 +> --- a/test/sexp +> +++ b/test/sexp +> @@ -29,7 +29,7 @@ test_expect_equal "$output" "((((:id \"${gen_msg_id}\" :match t :excluded nil :f +> test_begin_subtest "Show message: sexp, inline attachment filename" +> subject='sexp-show-inline-attachment-filename' +> id="sexp-show-inline-attachment-filename@notmuchmail.org" +> -emacs_deliver_message \ +> +emacs_fcc_message \ +> "$subject" \ +> 'This is a test message with inline attachment with a filename' \ +> "(mml-attach-file \"$TEST_DIRECTORY/README\" nil nil \"inline\") +> diff --git a/test/test-lib.sh b/test/test-lib.sh +> index 53cb947..66c0720 100644 +> --- a/test/test-lib.sh +> +++ b/test/test-lib.sh +> @@ -470,6 +470,35 @@ 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))) +> + (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 +> -- +> 1.8.4.3 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2