Re: Filesystem functionality used by notmuch
[notmuch-archives.git] / fe / 4e69a4f74466c765f0e4cebc4acf54d69d5a29
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
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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
42 Precedence: list\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
53 \r
54 Should have come before commit 1df71b55\r
55 \r
56 ---\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
61 \r
62 diff --git a/test/config b/test/config\r
63 new file mode 100755\r
64 index 0000000..ee3126c\r
65 --- /dev/null\r
66 +++ b/test/config\r
67 @@ -0,0 +1,88 @@\r
68 +#!/usr/bin/env bash\r
69 +test_description='notmuch config'\r
70 +. ./test-lib.sh\r
71 +\r
72 +\r
73 +config_options=(\r
74 +    "database.path"\r
75 +    "user.name"\r
76 +    "user.primary_email"\r
77 +    "user.other_email"\r
78 +    "new.tags"\r
79 +    "maildir.synchronize_flags"\r
80 +)\r
81 +\r
82 +\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
87 +done >> OUTPUT\r
88 +cat >EXPECTED <<EOF\r
89 +${MAIL_DIR}\r
90 +Notmuch Test Suite\r
91 +test_suite@notmuchmail.org\r
92 +test_suite_other@notmuchmail.org\r
93 +test_suite@otherdomain.org\r
94 +unread\r
95 +inbox\r
96 +true\r
97 +EOF\r
98 +test_expect_equal_file OUTPUT EXPECTED\r
99 +\r
100 +\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
111 +done >> OUTPUT\r
112 +cat >EXPECTED <<EOF\r
113 +/path/to/maildir\r
114 +User Name\r
115 +primary_email@notmuchmail.org\r
116 +alt1@notmuchmail.org\r
117 +alt2@notmuchmail.org\r
118 +tag1\r
119 +tag2\r
120 +tag3\r
121 +false\r
122 +EOF\r
123 +test_expect_equal_file OUTPUT EXPECTED\r
124 +\r
125 +\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
136 +done >> OUTPUT\r
137 +\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
143 +\r
144 +cat >EXPECTED <<EOF\r
145 +${HOME}/mail\r
146 +${fallback_name}\r
147 +${fallback_email}\r
148 +unread\r
149 +inbox\r
150 +true\r
151 +EOF\r
152 +test_expect_equal_file OUTPUT EXPECTED\r
153 +\r
154 +\r
155 +test_done\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
161  \r
162  TESTS="\r
163    basic\r
164 +  config\r
165    help-test\r
166    new\r
167    count\r
168 -- \r
169 1.7.8.1\r
170 \r