Re: [PATCH 2/3] test: Add a test for HTML email with inline images
authorAustin Clements <amdragon@MIT.EDU>
Wed, 3 Oct 2012 14:28:34 +0000 (10:28 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:42 +0000 (09:49 -0800)
bc/06d94b4824911b9bbc0681a6b49d445e171a2e [new file with mode: 0644]

diff --git a/bc/06d94b4824911b9bbc0681a6b49d445e171a2e b/bc/06d94b4824911b9bbc0681a6b49d445e171a2e
new file mode 100644 (file)
index 0000000..707ff40
--- /dev/null
@@ -0,0 +1,152 @@
+Return-Path: <amdragon@mit.edu>\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 78A98431FAF\r
+       for <notmuch@notmuchmail.org>; Wed,  3 Oct 2012 07:28:38 -0700 (PDT)\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 g7dKjNJusmxl for <notmuch@notmuchmail.org>;\r
+       Wed,  3 Oct 2012 07:28:38 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
+       [18.9.25.15])\r
+       by olra.theworths.org (Postfix) with ESMTP id D231D431FAE\r
+       for <notmuch@notmuchmail.org>; Wed,  3 Oct 2012 07:28:37 -0700 (PDT)\r
+X-AuditID: 1209190f-b7f636d00000095b-a1-506c4b95e4a1\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+       by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 90.BB.02395.59B4C605; Wed,  3 Oct 2012 10:28:37 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q93ESaqe026187; \r
+       Wed, 3 Oct 2012 10:28:37 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q93ESY1D027134\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Wed, 3 Oct 2012 10:28:35 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1TJPwA-0008E8-Ai; Wed, 03 Oct 2012 10:28:34 -0400\r
+Date: Wed, 3 Oct 2012 10:28:34 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+Subject: Re: [PATCH 2/3] test: Add a test for HTML email with inline images\r
+Message-ID: <20121003142834.GC14861@mit.edu>\r
+References: <1348941314-8377-1-git-send-email-amdragon@mit.edu>\r
+       <1348941314-8377-3-git-send-email-amdragon@mit.edu>\r
+       <87a9w3vqye.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87a9w3vqye.fsf@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFprAKsWRmVeSWpSXmKPExsUixG6nrjvVOyfAYMl2cYurW/vZLa7fnMns\r
+       wOSxc9Zddo9nq24xBzBFcdmkpOZklqUW6dslcGUcWX+PqWCBSMWlWV9ZGxinCHQxcnJICJhI\r
+       /F7ZwwJhi0lcuLeeDcQWEtjHKLHsRUEXIxeQvZ5R4tva1YwQzgkmiYdzFkE5SxglZny+wwTS\r
+       wiKgIjF18ypmEJtNQENi2/7ljCC2iIChxK2Lr8DizALSEt9+N4PVCwt4S3S9bABbzSugI9Ex\r
+       oYkdYugkRolDs1azQSQEJU7OfMIC0awlcePfS6BmDrBBy/9xgIQ5BdQlHi9aBFYuCnTDlJPb\r
+       2CYwCs1C0j0LSfcshO4FjMyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdE30cjNL9FJTSjcxggKb\r
+       U5J/B+O3g0qHGAU4GJV4eCX+ZwUIsSaWFVfmHmKU5GBSEuUVccsJEOJLyk+pzEgszogvKs1J\r
+       LT7EKMHBrCTC62oDlONNSaysSi3Kh0lJc7AoifNeTbnpLySQnliSmp2aWpBaBJOV4eBQkuCN\r
+       8wJqFCxKTU+tSMvMKUFIM3FwggznARq+1hNkeHFBYm5xZjpE/hSjLsfOEwseMAqx5OXnpUqJ\r
+       8x4DGSQAUpRRmgc3B5aQXjGKA70lzJsNUsUDTGZwk14BLWECWrJCNwtkSUkiQkqqgTGLz16a\r
+       02A/a/z/Z4XRt08cuTZT3vbwg1/PC/LlHJ5Pvy/+2641KfxkYEcf76dJVw/eErS22qs1y3zv\r
+       JAeHDevcjvvsVZY6u2LWS55My0vPXmnck3tfu+rbTtu+0qtXZIRWV+TZmM2rZsxdpPOR9X9u\r
+       wO+v2qJfrwVv/ln8ec6eo2GPn/341vNJiaU4I9FQi7moOBEAn+sdESMDAAA=\r
+Cc: notmuch@notmuchmail.org\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, 03 Oct 2012 14:28:38 -0000\r
+\r
+Quoth Dmitry Kurochkin on Oct 03 at  1:35 pm:\r
+> Hi Austin.\r
+> \r
+> Austin Clements <amdragon@MIT.EDU> writes:\r
+> \r
+> > Currently this test passes in Emacs 23 but fails in Emacs 24 (at least\r
+> > on some Linux distributions).\r
+> \r
+> The test fails for me on Emacs 23.4.1 (Debian unstable):\r
+> \r
+>  FAIL   Rendering HTML mail with images\r
+>      --- emacs.51.OUTPUT     2012-10-03 09:31:33.383529764 +0000\r
+>      +++ emacs.51.EXPECTED   2012-10-03 09:31:33.383529764 +0000\r
+>      @@ -6,4 +6,3 @@\r
+>       [ multipart/related ]\r
+>       [ text/html ]\r
+>       *\r
+>      -\r
+> \r
+> Did not look into details.\r
+\r
+Yes.  This test is (in hindsight, unsurprisingly) sensitive to\r
+whatever HTML renderer Emacs chooses.  It looks like you're probably\r
+using html2text, which outputs nothing for an image.  Unfortunately,\r
+none of the built-in renderers in Emacs 23 are aware of content\r
+references, which makes this test rather pointless on Emacs 23 unless\r
+we depend on an external renderer.\r
+\r
+The best solution I can think of dynamically chooses shr on Emacs 24\r
+(since that's really what we're trying to test) and gives up on Emacs\r
+23 and forcibly selects html2text (test patch below).  Alternatively,\r
+we could cycle through all of the available renderers, test everything\r
+that we can, and just ignore everything that we can't run, though that\r
+would make the test environment-sensitive.\r
+\r
+diff --git a/test/emacs b/test/emacs\r
+index 1f84b91..2ef78bf 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -756,7 +756,7 @@ add_message '[subject]="HTML mail with images"' \\r
+     '[body]="--abcd\r
+ Content-Type: text/html\r
\r
+-<img src="cid:330@goomoji.gmail">\r
++<img src="cid:330@goomoji.gmail"> smiley\r
\r
+ --abcd\r
+ Content-Type: image/gif\r
+@@ -766,10 +766,13 @@ Content-ID: <330@goomoji.gmail>\r
+ R0lGODlhDAAMAKIFAF5LAP/zxAAAANyuAP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMl\r
+ WLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7\r
+ --abcd--"'\r
+-test_emacs "(notmuch-show \"id:${gen_msg_id}\")\r
++test_emacs "(let ((mm-text-html-renderer\r
++                  (if (assq 'shr mm-text-html-renderer-alist)\r
++                      'shr 'html2text)))\r
++             (notmuch-show \"id:${gen_msg_id}\"))\r
+            (test-output)"\r
+ # Normalize output for Emacs 23 and Emacs 24\r
+-sed -i 's/\[cid\]/*/' OUTPUT\r
++sed -i 's/^ smiley/* smiley/' OUTPUT\r
+ cat <<EOF >EXPECTED\r
+ Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)\r
+ Subject: HTML mail with images\r
+@@ -778,7 +781,7 @@ Date: Fri, 05 Jan 2001 15:43:57 +0000\r
\r
+ [ multipart/related ]\r
+ [ text/html ]\r
+-*\r
++* smiley\r
+ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
\r
+\r