1 Return-Path: <pieter@praet.org>
\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 D6C46429E35
\r
6 for <notmuch@notmuchmail.org>; Sat, 14 Jan 2012 00:59:43 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 mkDZDz4znikZ for <notmuch@notmuchmail.org>;
\r
16 Sat, 14 Jan 2012 00:59:42 -0800 (PST)
\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
18 [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 9777A431FB6
\r
21 for <notmuch@notmuchmail.org>; Sat, 14 Jan 2012 00:59:42 -0800 (PST)
\r
22 Received: by werh12 with SMTP id h12so7105wer.26
\r
23 for <notmuch@notmuchmail.org>; Sat, 14 Jan 2012 00:59:41 -0800 (PST)
\r
24 Received: by 10.216.133.19 with SMTP id p19mr520462wei.0.1326531581392;
\r
25 Sat, 14 Jan 2012 00:59:41 -0800 (PST)
\r
26 Received: from localhost ([109.131.75.86])
\r
27 by mx.google.com with ESMTPS id fc6sm9708860wbb.16.2012.01.14.00.59.40
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Sat, 14 Jan 2012 00:59:40 -0800 (PST)
\r
30 From: Pieter Praet <pieter@praet.org>
\r
31 To: David Bremner <david@tethera.net>
\r
32 Subject: [PATCH] test: cli: getting/setting/removing config values
\r
33 Date: Sat, 14 Jan 2012 09:57:56 +0100
\r
34 Message-Id: <1326531476-14556-1-git-send-email-pieter@praet.org>
\r
35 X-Mailer: git-send-email 1.7.8.1
\r
36 In-Reply-To: <8739bir7do.fsf@praet.org>
\r
37 References: <8739bir7do.fsf@praet.org>
\r
38 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
39 X-BeenThere: notmuch@notmuchmail.org
\r
40 X-Mailman-Version: 2.1.13
\r
42 List-Id: "Use and development of the notmuch mail system."
\r
43 <notmuch.notmuchmail.org>
\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
47 List-Post: <mailto:notmuch@notmuchmail.org>
\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
50 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
51 X-List-Received-Date: Sat, 14 Jan 2012 08:59:44 -0000
\r
53 Full test coverage for getting, setting and removing options in
\r
54 notmuch(1)'s config file ($NOTMUCH_CONFIG or $HOME/.notmuch-config).
\r
57 Please *do* take note of the FIXME in the last test!
\r
59 test/config | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
60 test/notmuch-test | 1 +
\r
61 2 files changed, 89 insertions(+), 0 deletions(-)
\r
62 create mode 100755 test/config
\r
64 diff --git a/test/config b/test/config
\r
65 new file mode 100755
\r
66 index 0000000..ee3126c
\r
70 +#!/usr/bin/env bash
\r
71 +test_description='notmuch config'
\r
78 + "user.primary_email"
\r
79 + "user.other_email"
\r
81 + "maildir.synchronize_flags"
\r
85 +test_begin_subtest 'getting config: "config get <section>.<item>"'
\r
86 +echo -n "" > OUTPUT
\r
87 +for i in ${config_options[*]} ; do
\r
88 + notmuch config get "${i}"
\r
90 +cat >EXPECTED <<EOF
\r
93 +test_suite@notmuchmail.org
\r
94 +test_suite_other@notmuchmail.org
\r
95 +test_suite@otherdomain.org
\r
100 +test_expect_equal_file OUTPUT EXPECTED
\r
103 +test_begin_subtest 'setting config: "config set <section>.<item> [values ...]"'
\r
104 +notmuch config set database.path /path/to/maildir
\r
105 +notmuch config set user.name "User Name"
\r
106 +notmuch config set user.primary_email primary_email@notmuchmail.org
\r
107 +notmuch config set user.other_email alt1@notmuchmail.org alt2@notmuchmail.org
\r
108 +notmuch config set new.tags tag1 tag2 tag3
\r
109 +notmuch config set maildir.synchronize_flags false
\r
110 +echo -n "" > OUTPUT
\r
111 +for i in ${config_options[*]} ; do
\r
112 + notmuch config get "${i}"
\r
114 +cat >EXPECTED <<EOF
\r
117 +primary_email@notmuchmail.org
\r
118 +alt1@notmuchmail.org
\r
119 +alt2@notmuchmail.org
\r
125 +test_expect_equal_file OUTPUT EXPECTED
\r
128 +test_begin_subtest 'removing config: "config set <section>.<item>"'
\r
129 +notmuch config set database.path
\r
130 +notmuch config set user.name
\r
131 +notmuch config set user.primary_email
\r
132 +notmuch config set user.other_email
\r
133 +notmuch config set new.tags
\r
134 +notmuch config set maildir.synchronize_flags
\r
135 +echo -n "" > OUTPUT
\r
136 +for i in ${config_options[*]} ; do
\r
137 + notmuch config get "${i}"
\r
140 +# FIXME: Not the most robust nor portable solution here...
\r
141 +# Especially `hostname --domain' may have unwanted effects on
\r
142 +# some platforms, e.g. setting your hostname to "--domain" ;)
\r
143 +fallback_name="$(grep $(id -un) /etc/passwd | cut -d ":" -f 5 | cut -d "," -f 1)"
\r
144 +fallback_email="$(id -un)@$(hostname).$(hostname --domain)"
\r
146 +cat >EXPECTED <<EOF
\r
154 +test_expect_equal_file OUTPUT EXPECTED
\r
158 diff --git a/test/notmuch-test b/test/notmuch-test
\r
159 index e40ef86..f0c1d7c 100755
\r
160 --- a/test/notmuch-test
\r
161 +++ b/test/notmuch-test
\r
162 @@ -18,6 +18,7 @@ cd $(dirname "$0")
\r