1 Return-Path: <dkg@fifthhorseman.net>
\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 arlo.cworth.org (Postfix) with ESMTP id 438816DE1B8B
\r
6 for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 12:40:21 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id ua34pvW6G1oy for <notmuch@notmuchmail.org>;
\r
16 Sun, 31 Jan 2016 12:40:19 -0800 (PST)
\r
17 Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])
\r
18 by arlo.cworth.org (Postfix) with ESMTP id 9A62B6DE1ACD
\r
19 for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 12:40:09 -0800 (PST)
\r
20 Received: from fifthhorseman.net (ip-64-134-185-108.public.wayport.net
\r
22 by che.mayfirst.org (Postfix) with ESMTPSA id E9615F9A4
\r
23 for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 15:40:06 -0500 (EST)
\r
24 Received: by fifthhorseman.net (Postfix, from userid 1000)
\r
25 id 6198E211A2; Sun, 31 Jan 2016 15:40:06 -0500 (EST)
\r
26 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
\r
27 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
28 Subject: [PATCH v3 14/16] test indexing cleartext version of delivered
\r
30 Date: Sun, 31 Jan 2016 15:39:59 -0500
\r
31 Message-Id: <1454272801-23623-15-git-send-email-dkg@fifthhorseman.net>
\r
32 X-Mailer: git-send-email 2.7.0.rc3
\r
33 In-Reply-To: <1454272801-23623-1-git-send-email-dkg@fifthhorseman.net>
\r
34 References: <1454272801-23623-1-git-send-email-dkg@fifthhorseman.net>
\r
35 X-BeenThere: notmuch@notmuchmail.org
\r
36 X-Mailman-Version: 2.1.20
\r
38 List-Id: "Use and development of the notmuch mail system."
\r
39 <notmuch.notmuchmail.org>
\r
40 List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
47 X-List-Received-Date: Sun, 31 Jan 2016 20:40:21 -0000
\r
49 This requires a bit of reorganization:
\r
51 * add_gnupg_home gets moved to test-lib.sh, and
\r
53 * we allow passing --long-arguments to "notmuch new" via
\r
56 test/T350-crypto.sh | 15 ---------------
\r
57 test/T357-index-decryption.sh | 42 ++++++++++++++++++++++++++++++++++++++++++
\r
58 test/test-lib.sh | 26 +++++++++++++++++++++++++-
\r
59 3 files changed, 67 insertions(+), 16 deletions(-)
\r
60 create mode 100755 test/T357-index-decryption.sh
\r
62 diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh
\r
63 index 4bc15bc..50cc526 100755
\r
64 --- a/test/T350-crypto.sh
\r
65 +++ b/test/T350-crypto.sh
\r
67 test_description='PGP/MIME signature verification and decryption'
\r
68 . ./test-lib.sh || exit 1
\r
73 - [ -d ${GNUPGHOME} ] && return
\r
74 - mkdir -m 0700 "$GNUPGHOME"
\r
75 - $GPG --no-tty --import <$TEST_DIRECTORY/gnupg-secret-key.asc >"$GNUPGHOME"/import.log 2>&1
\r
76 - test_debug "cat $GNUPGHOME/import.log"
\r
77 - if ($GPG --quick-random --version >/dev/null 2>&1) ; then
\r
78 - echo quick-random >> "$GNUPGHOME"/gpg.conf
\r
79 - elif ($GPG --debug-quick-random --version >/dev/null 2>&1) ; then
\r
80 - echo debug-quick-random >> "$GNUPGHOME"/gpg.conf
\r
82 - echo no-emit-version >> "$GNUPGHOME"/gpg.conf
\r
85 ##################################################
\r
88 diff --git a/test/T357-index-decryption.sh b/test/T357-index-decryption.sh
\r
89 new file mode 100755
\r
90 index 0000000..03e49cc
\r
92 +++ b/test/T357-index-decryption.sh
\r
94 +#!/usr/bin/env bash
\r
96 +# TODO: test index-decryption-failed
\r
98 +test_description='indexing decrypted mail'
\r
99 +. ./test-lib.sh || exit 1
\r
101 +##################################################
\r
104 +# get key fingerprint
\r
105 +FINGERPRINT=$($GPG --no-tty --list-secret-keys --with-colons --fingerprint | grep '^fpr:' | cut -d: -f10)
\r
107 +# create a test encrypted message
\r
108 +test_expect_success 'emacs delivery of encrypted message' \
\r
109 +'emacs_fcc_message \
\r
110 + "test encrypted message for cleartext index 001" \
\r
111 + "This is a test encrypted message with a wumpus.\n" \
\r
112 + "(mml-secure-message-encrypt)"'
\r
114 +test_begin_subtest "search for unindexed cleartext"
\r
115 +output=$(notmuch search wumpus)
\r
117 +test_expect_equal \
\r
121 +# create a test encrypted message that is indexed in the clear
\r
122 +test_expect_success 'emacs delivery of encrypted message' \
\r
123 +'emacs_fcc_message --try-decrypt \
\r
124 + "test encrypted message for cleartext index 002" \
\r
125 + "This is a test encrypted message with a wumpus.\n" \
\r
126 + "(mml-secure-message-encrypt)"'
\r
128 +test_begin_subtest "emacs delivery of encrypted message, indexed cleartext"
\r
129 +output=$(notmuch search wumpus)
\r
130 +expected='thread:0000000000000002 2000-01-01 [1/1] Notmuch Test Suite; test encrypted message for cleartext index 002 (encrypted inbox index-decrypted)'
\r
131 +test_expect_equal \
\r
136 diff --git a/test/test-lib.sh b/test/test-lib.sh
\r
137 index 8c1f3c6..1fea6c7 100644
\r
138 --- a/test/test-lib.sh
\r
139 +++ b/test/test-lib.sh
\r
140 @@ -92,6 +92,21 @@ else
\r
147 + [ -d ${GNUPGHOME} ] && return
\r
148 + mkdir -m 0700 "$GNUPGHOME"
\r
149 + $GPG --no-tty --import <$TEST_DIRECTORY/gnupg-secret-key.asc >"$GNUPGHOME"/import.log 2>&1
\r
150 + test_debug "cat $GNUPGHOME/import.log"
\r
151 + if ($GPG --quick-random --version >/dev/null 2>&1) ; then
\r
152 + echo quick-random >> "$GNUPGHOME"/gpg.conf
\r
153 + elif ($GPG --debug-quick-random --version >/dev/null 2>&1) ; then
\r
154 + echo debug-quick-random >> "$GNUPGHOME"/gpg.conf
\r
156 + echo no-emit-version >> "$GNUPGHOME"/gpg.conf
\r
161 # A regexp to match 5 and 40 hexdigits
\r
162 @@ -514,8 +529,17 @@ emacs_deliver_message ()
\r
163 # Accepts arbitrary extra emacs/elisp functions to modify the message
\r
164 # before sending, which is useful to doing things like attaching files
\r
165 # to the message and encrypting/signing.
\r
167 +# If any GNU-style long-arguments (like --quiet or --try-decrypt) are
\r
168 +# at the head of the argument list, they are sent directly to "notmuch
\r
169 +# new" after message delivery
\r
170 emacs_fcc_message ()
\r
172 + local nmn_args=''
\r
173 + while [[ "$1" =~ ^-- ]]; do
\r
174 + nmn_args="$nmn_args $1"
\r
180 @@ -534,7 +558,7 @@ emacs_fcc_message ()
\r
181 (insert \"${body}\")
\r
183 (notmuch-mua-send-and-exit))" || return 1
\r
184 - notmuch new >/dev/null
\r
185 + notmuch new $nmn_args >/dev/null
\r
188 # Generate a corpus of email and add it to the database.
\r