Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 36 / 0941f80c173ce281ac257115d897a05d60abc2
1 Return-Path: <bremner@tesseract.cs.unb.ca>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 1CF42431E82\r
6         for <notmuch@notmuchmail.org>; Sun,  8 Dec 2013 07:52:57 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id GZ4Rn0sg1t62 for <notmuch@notmuchmail.org>;\r
16         Sun,  8 Dec 2013 07:52:49 -0800 (PST)\r
17 Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155])\r
18         (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 42953431FDA\r
21         for <notmuch@notmuchmail.org>; Sun,  8 Dec 2013 07:52:49 -0800 (PST)\r
22 Received: from remotemail by yantan.tethera.net with local (Exim 4.80)\r
23         (envelope-from <bremner@tesseract.cs.unb.ca>)\r
24         id 1Vpgf1-0006AE-8s; Sun, 08 Dec 2013 11:52:47 -0400\r
25 Received: (nullmailer pid 22780 invoked by uid 1000); Sun, 08 Dec 2013\r
26         15:52:31 -0000\r
27 From: David Bremner <david@tethera.net>\r
28 To: notmuch@notmuchmail.org\r
29 Subject: [PATCH 2/4] test: sanitize Date and timestamp fields in json\r
30 Date: Sun,  8 Dec 2013 23:52:24 +0800\r
31 Message-Id: <1386517946-22054-3-git-send-email-david@tethera.net>\r
32 X-Mailer: git-send-email 1.8.4.3\r
33 In-Reply-To: <1386517946-22054-1-git-send-email-david@tethera.net>\r
34 References: <1386517946-22054-1-git-send-email-david@tethera.net>\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.13\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39         <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
41         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Sun, 08 Dec 2013 15:52:57 -0000\r
48 \r
49 Eventually we want test messages to have distinct dates to avoid\r
50 reproducability problems. This sanitization will prevent some test\r
51 failures when that change is made.\r
52 \r
53 Replace the use of a local function in maildir-sync with\r
54 notmuch_json_show_sanitize\r
55 ---\r
56  test/maildir-sync | 15 +++++----------\r
57  test/test-lib.sh  |  4 +++-\r
58  2 files changed, 8 insertions(+), 11 deletions(-)\r
59 \r
60 diff --git a/test/maildir-sync b/test/maildir-sync\r
61 index 33d2c58..3186e70 100755\r
62 --- a/test/maildir-sync\r
63 +++ b/test/maildir-sync\r
64 @@ -4,11 +4,6 @@ test_description="maildir synchronization"\r
65  \r
66  . ./test-lib.sh\r
67  \r
68 -# Avoid including the local value of MAIL_DIR in the result.\r
69 -filter_show_json() {\r
70 -    sed -e "s|${MAIL_DIR}/|MAIL_DIR/|"\r
71 -}\r
72 -\r
73  # Create the expected maildir structure\r
74  mkdir $MAIL_DIR/cur\r
75  mkdir $MAIL_DIR/new\r
76 @@ -40,18 +35,18 @@ output=$(cd ${MAIL_DIR}/cur; ls -1 adding-replied*)\r
77  test_expect_equal "$output" "adding-replied-tag:2,RS"\r
78  \r
79  test_begin_subtest "notmuch show works with renamed file (without notmuch new)"\r
80 -output=$(notmuch show --format=json id:${gen_msg_id} | filter_show_json)\r
81 -test_expect_equal_json "$output" '[[[{"id": "adding-replied-tag@notmuch-test-suite",\r
82 +output=$(notmuch show --format=json id:${gen_msg_id} | notmuch_json_show_sanitize)\r
83 +test_expect_equal_json "$output" '[[[{"id": "XXXXX",\r
84  "match": true,\r
85  "excluded": false,\r
86 -"filename": "MAIL_DIR/cur/adding-replied-tag:2,RS",\r
87 -"timestamp": 978709437,\r
88 +"filename": "YYYYY",\r
89 +"timestamp": 42,\r
90  "date_relative": "2001-01-05",\r
91  "tags": ["inbox","replied"],\r
92  "headers": {"Subject": "Adding replied tag",\r
93  "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
94  "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
95 -"Date": "Fri, 05 Jan 2001 15:43:57 +0000"},\r
96 +"Date": "GENERATED_DATE"},\r
97  "body": [{"id": 1,\r
98  "content-type": "text/plain",\r
99  "content": "This is just a test message (#3)\n"}]},\r
100 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
101 index 8611ba5..9d2f805 100644\r
102 --- a/test/test-lib.sh\r
103 +++ b/test/test-lib.sh\r
104 @@ -625,7 +625,9 @@ notmuch_json_show_sanitize ()\r
105  {\r
106      sed \\r
107         -e 's|"id": "[^"]*",|"id": "XXXXX",|g' \\r
108 -       -e 's|"filename": "/[^"]*",|"filename": "YYYYY",|g'\r
109 +       -e 's|"Date": "Fri[^"]*0000"|"Date": "GENERATED_DATE"|g' \\r
110 +       -e 's|"filename": "/[^"]*",|"filename": "YYYYY",|g' \\r
111 +       -e 's|"timestamp": 97.......|"timestamp": 42|g'\r
112  }\r
113  \r
114  notmuch_emacs_error_sanitize ()\r
115 -- \r
116 1.8.4.3\r
117 \r