Re: [PATCH v2 2/4] test: emacs: new test "notmuch-search: replying to a thread (sending)"
authorPieter Praet <pieter@praet.org>
Wed, 22 Feb 2012 18:49:06 +0000 (19:49 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:50 +0000 (09:44 -0800)
5e/5ccd6cd541b62b5044ace1bf83e79c1f900050 [new file with mode: 0644]

diff --git a/5e/5ccd6cd541b62b5044ace1bf83e79c1f900050 b/5e/5ccd6cd541b62b5044ace1bf83e79c1f900050
new file mode 100644 (file)
index 0000000..c233b4e
--- /dev/null
@@ -0,0 +1,161 @@
+Return-Path: <pieter@praet.org>\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 F0A17431FB6\r
+       for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:51:25 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 h6ydeWI61OUl for <notmuch@notmuchmail.org>;\r
+       Wed, 22 Feb 2012 10:51:25 -0800 (PST)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+       [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 137DE431FAE\r
+       for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:51:24 -0800 (PST)\r
+Received: by werp13 with SMTP id p13so271229wer.26\r
+       for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:51:23 -0800 (PST)\r
+Received-SPF: pass (google.com: domain of pieter@praet.org designates\r
+       10.180.8.226 as permitted sender) client-ip=10.180.8.226; \r
+Authentication-Results: mr.google.com;\r
+       spf=pass (google.com: domain of pieter@praet.org\r
+       designates 10.180.8.226 as permitted sender)\r
+       smtp.mail=pieter@praet.org\r
+Received: from mr.google.com ([10.180.8.226])\r
+       by 10.180.8.226 with SMTP id u2mr38182096wia.16.1329936683943 (num_hops\r
+       = 1); Wed, 22 Feb 2012 10:51:23 -0800 (PST)\r
+Received: by 10.180.8.226 with SMTP id u2mr31530245wia.16.1329936683696;\r
+       Wed, 22 Feb 2012 10:51:23 -0800 (PST)\r
+Received: from localhost ([109.131.181.26])\r
+       by mx.google.com with ESMTPS id h19sm30965911wiw.9.2012.02.22.10.51.22\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 22 Feb 2012 10:51:23 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: Tomi Ollila <tomi.ollila@iki.fi>, Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH v2 2/4] test: emacs: new test "notmuch-search: replying to\r
+       a thread (sending)"\r
+In-Reply-To: <m239a6wn4p.fsf@guru.guru-group.fi>\r
+References: <1310313335-4159-1-git-send-email-pieter@praet.org>\r
+       <1329683908-5435-1-git-send-email-pieter@praet.org>\r
+       <1329683908-5435-3-git-send-email-pieter@praet.org>\r
+       <m239a6wn4p.fsf@guru.guru-group.fi>\r
+User-Agent: Notmuch/0.11.1+210~g6afc43e (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-unknown-linux-gnu)\r
+Date: Wed, 22 Feb 2012 19:49:06 +0100\r
+Message-ID: <87mx8a900t.fsf@praet.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Gm-Message-State:\r
+ ALoCoQn+r6juyr1TyDjY9oZ0brpqBePwlF6FuqwwqlPB0jI3t96iSMtyXgq66rb3UzvRErG6MWak\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: Wed, 22 Feb 2012 18:51:26 -0000\r
+\r
+On Sun, 19 Feb 2012 23:04:38 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
+> On Sun, 19 Feb 2012 21:38:26 +0100, Pieter Praet <pieter@praet.org> wrote:\r
+> > As pointed out in the previous commit, the test for replying from\r
+> > within Emacs didn't actually submit the reply. This one does.\r
+> > ---\r
+> >  test/emacs |   41 +++++++++++++++++++++++++++++++++++++++++\r
+> >  1 files changed, 41 insertions(+), 0 deletions(-)\r
+> > \r
+> > diff --git a/test/emacs b/test/emacs\r
+> > index 308d749..0f4f42b 100755\r
+> > --- a/test/emacs\r
+> > +++ b/test/emacs\r
+> > @@ -273,6 +273,47 @@ On 01 Jan 2000 12:00:00 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> w\r
+> >  EOF\r
+> >  test_expect_equal_file OUTPUT EXPECTED\r
+> >  \r
+> > +test_begin_subtest "notmuch-search: replying to a thread (sending)"\r
+> > +$TEST_DIRECTORY/smtp-dummy sent_message &\r
+> > +smtp_dummy_pid=$!\r
+> > +test_emacs \\r
+> > +'(let ((message-send-mail-function '\''message-smtpmail-send-it)\r
+> > +       (smtpmail-smtp-server "localhost")\r
+> > +       (smtpmail-smtp-service "25025"))\r
+> > +  (notmuch-search "subject:\"testing message sent via SMTP\"")\r
+> > +  (notmuch-test-wait)\r
+> > +  (notmuch-search-reply-to-thread)\r
+> > +  (end-of-buffer)\r
+> > +  (newline)\r
+> > +  (insert "Reply to a message via Emacs with fake SMTP")\r
+> > +  (message-send-and-exit))' >/dev/null 2>&1\r
+> > +wait ${smtp_dummy_pid}\r
+> > +notmuch new >/dev/null\r
+> \r
+> The above part smells like CopyPasteProgramming; (old version of) \r
+> emacs_deliver_message copied (old as this version is lacking\r
+> opportunistic quit). \r
+>\r
+\r
+Nope, "Sending a message via (fake) SMTP", around 2011-05 to be exact [1].\r
+\r
+My main intention was to get a bugfix [2] applied (still isn't BTW),\r
+which might have been expedited by providing a test which checks\r
+whether messages are properly tagged 'replied' when and *only* when\r
+applicable, and for that I needed a quick way to test replying to a\r
+thread, so I lazily repurposed an existing test.  Not much point in\r
+reinventing the wheel, is there?\r
+\r
+Still haven't gotten around to writing the actual test to demonstrate\r
+that messages are tagged 'replied' prematurely, but this should be the\r
+gist of it:\r
+\r
+  #+begin_src emacs-lisp\r
+    ;; ask for confirmation (using `y-or-n-p') before sending\r
+    (let ((message-confirm-send t))\r
+      ;; temporarily redefine `y-or-n-p', immediately returns nil\r
+      (flet ((y-or-n-p (&rest args) nil))\r
+        ;; then try to send message (which will fail)\r
+        (message-send-and-exit)))\r
+\r
+    ;; Parent message should NOT be tagged 'replied' now, yet it is,\r
+    ;; since `notmuch-message-mark-replied' is added to `message-send-hook'\r
+    ;; instead of `message-sent-hook'.\r
+  #+end_src\r
+\r
+\r
+> Maybe the functionality of emacs_deliver_message needs to be\r
+> split into 3 parts: initialization, sending and finalization.\r
+> then other uses can use initialization and finalization parts\r
+> and provide their own sending part.\r
+>\r
+\r
+That would be *much* better, indeed.\r
+\r
+\r
+> I have work-in-progress code for initialization and finalization\r
+> parts of that and I don't want to do the changes in 2 places...\r
+>\r
+\r
+OK.  I'll mark this patch (and the next, which depends on it) as 'wip',\r
+and pick them up again when your refactoring efforts hit mainline.\r
+\r
+\r
+> Tomi\r
+\r
+\r
+Peace\r
+\r
+-- \r
+Pieter\r
+\r
+[1] id:"1305299270-4316-1-git-send-email-pieter@praet.org"\r
+[2] id:"1305275652-22956-1-git-send-email-pieter@praet.org"\r