Re: [PATCH 2/3] test: Add a test for HTML email with inline images
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Wed, 3 Oct 2012 14:41:07 +0000 (18:41 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:43 +0000 (09:49 -0800)
a8/60d35604c74aa7f4ad0d7cdf0c8eec9e51cb83 [new file with mode: 0644]

diff --git a/a8/60d35604c74aa7f4ad0d7cdf0c8eec9e51cb83 b/a8/60d35604c74aa7f4ad0d7cdf0c8eec9e51cb83
new file mode 100644 (file)
index 0000000..5b83056
--- /dev/null
@@ -0,0 +1,150 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\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 A2BEA431FB6\r
+       for <notmuch@notmuchmail.org>; Wed,  3 Oct 2012 07:41:13 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, 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 8w5ucht2Dp4G for <notmuch@notmuchmail.org>;\r
+       Wed,  3 Oct 2012 07:41:13 -0700 (PDT)\r
+Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
+       [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id B21AB431FAE\r
+       for <notmuch@notmuchmail.org>; Wed,  3 Oct 2012 07:41:12 -0700 (PDT)\r
+Received: by lbbgg6 with SMTP id gg6so6442350lbb.26\r
+       for <notmuch@notmuchmail.org>; Wed, 03 Oct 2012 07:41:09 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
+       :message-id:mime-version:content-type;\r
+       bh=SNRgZAG19pGg8BdWyQXLe3ZnivGbSsGx7ILkCot0/Q4=;\r
+       b=Ku+ZsXIyj8wiafXRmd/DtQtmQfav/vQWwPOCjMqZnXz58gQ7FDona3KkdFWHNVomM6\r
+       MyPpt9OFK6z32MqAPQa+sWTEd3reJniLzNV0FnLfwk32esyK8ZvA+mJSdo+SzpVkc60m\r
+       cAeV17CrYSFnASGtZA60D1ZaMGeAZC4cgRm6Ah+XrA/SVJdbmdsOrxIIkpvmo2RBHwIh\r
+       RfREmZFCYesD3RXmFp0fiHrrOeKDSdT/Fk/ajL2zdHbSA5DnY5C0KwiHE0vv01fZf2Z+\r
+       oJMsXFMFwztROu6gaQOpJCTBRJW7GDyqClYhaCRcAvpV3zRbqn8g6xWXXzwrakRefq3i\r
+       nzLg==\r
+Received: by 10.112.38.39 with SMTP id d7mr1785649lbk.112.1349275269802;\r
+       Wed, 03 Oct 2012 07:41:09 -0700 (PDT)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id oj5sm1411951lab.8.2012.10.03.07.41.08\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 03 Oct 2012 07:41:08 -0700 (PDT)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: Austin Clements <amdragon@MIT.EDU>\r
+Subject: Re: [PATCH 2/3] test: Add a test for HTML email with inline images\r
+In-Reply-To: <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> <20121003142834.GC14861@mit.edu>\r
+User-Agent: Notmuch/0.14+38~g322117b (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Wed, 03 Oct 2012 18:41:07 +0400\r
+Message-ID: <87iparwrcs.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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:41:13 -0000\r
+\r
+Austin Clements <amdragon@MIT.EDU> writes:\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
+\r
+Perhaps the test should be skipped if shr is not available, like we do\r
+for missing binaries?\r
+\r
+Regards,\r
+  Dmitry\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