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 431B0429E26
\r
6 for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:31:57 -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 gidwN15mxerH for <notmuch@notmuchmail.org>;
\r
16 Thu, 12 Jan 2012 09:31:56 -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 085E9431FB6
\r
21 for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:31:55 -0800 (PST)
\r
22 Received: by werm12 with SMTP id m12so1813791wer.26
\r
23 for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:31:54 -0800 (PST)
\r
24 Received: by 10.216.137.97 with SMTP id x75mr431119wei.57.1326389514805;
\r
25 Thu, 12 Jan 2012 09:31:54 -0800 (PST)
\r
26 Received: from localhost ([109.131.126.209])
\r
27 by mx.google.com with ESMTPS id h13sm6506454wbn.17.2012.01.12.09.31.54
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Thu, 12 Jan 2012 09:31:54 -0800 (PST)
\r
30 From: Pieter Praet <pieter@praet.org>
\r
31 To: David Bremner <david@tethera.net>,
\r
32 Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
33 Subject: [PATCH] test: cli: getting/setting/removing config values
\r
34 Date: Thu, 12 Jan 2012 18:30:01 +0100
\r
35 Message-Id: <1326389401-20468-1-git-send-email-pieter@praet.org>
\r
36 X-Mailer: git-send-email 1.7.8.1
\r
37 In-Reply-To: <87y5tckf1y.fsf@praet.org>
\r
38 References: <87y5tckf1y.fsf@praet.org>
\r
39 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Thu, 12 Jan 2012 17:31:57 -0000
\r
54 Should have come before commit 1df71b55
\r
57 test/config | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
58 test/notmuch-test | 1 +
\r
59 2 files changed, 89 insertions(+), 0 deletions(-)
\r
60 create mode 100755 test/config
\r
62 diff --git a/test/config b/test/config
\r
63 new file mode 100755
\r
64 index 0000000..ee3126c
\r
68 +#!/usr/bin/env bash
\r
69 +test_description='notmuch config'
\r
76 + "user.primary_email"
\r
77 + "user.other_email"
\r
79 + "maildir.synchronize_flags"
\r
83 +test_begin_subtest 'getting config: "config get <section>.<item>"'
\r
84 +echo -n "" > OUTPUT
\r
85 +for i in ${config_options[*]} ; do
\r
86 + notmuch config get "${i}"
\r
88 +cat >EXPECTED <<EOF
\r
91 +test_suite@notmuchmail.org
\r
92 +test_suite_other@notmuchmail.org
\r
93 +test_suite@otherdomain.org
\r
98 +test_expect_equal_file OUTPUT EXPECTED
\r
101 +test_begin_subtest 'setting config: "config set <section>.<item> [values ...]"'
\r
102 +notmuch config set database.path /path/to/maildir
\r
103 +notmuch config set user.name "User Name"
\r
104 +notmuch config set user.primary_email primary_email@notmuchmail.org
\r
105 +notmuch config set user.other_email alt1@notmuchmail.org alt2@notmuchmail.org
\r
106 +notmuch config set new.tags tag1 tag2 tag3
\r
107 +notmuch config set maildir.synchronize_flags false
\r
108 +echo -n "" > OUTPUT
\r
109 +for i in ${config_options[*]} ; do
\r
110 + notmuch config get "${i}"
\r
112 +cat >EXPECTED <<EOF
\r
115 +primary_email@notmuchmail.org
\r
116 +alt1@notmuchmail.org
\r
117 +alt2@notmuchmail.org
\r
123 +test_expect_equal_file OUTPUT EXPECTED
\r
126 +test_begin_subtest 'removing config: "config set <section>.<item>"'
\r
127 +notmuch config set database.path
\r
128 +notmuch config set user.name
\r
129 +notmuch config set user.primary_email
\r
130 +notmuch config set user.other_email
\r
131 +notmuch config set new.tags
\r
132 +notmuch config set maildir.synchronize_flags
\r
133 +echo -n "" > OUTPUT
\r
134 +for i in ${config_options[*]} ; do
\r
135 + notmuch config get "${i}"
\r
138 +# FIXME: Not the most robust nor portable solution here...
\r
139 +# Especially `hostname --domain' may have unwanted effects on
\r
140 +# some platforms, e.g. setting your hostname to "--domain" ;)
\r
141 +fallback_name="$(grep $(id -un) /etc/passwd | cut -d ":" -f 5 | cut -d "," -f 1)"
\r
142 +fallback_email="$(id -un)@$(hostname).$(hostname --domain)"
\r
144 +cat >EXPECTED <<EOF
\r
152 +test_expect_equal_file OUTPUT EXPECTED
\r
156 diff --git a/test/notmuch-test b/test/notmuch-test
\r
157 index e40ef86..f0c1d7c 100755
\r
158 --- a/test/notmuch-test
\r
159 +++ b/test/notmuch-test
\r
160 @@ -18,6 +18,7 @@ cd $(dirname "$0")
\r