summaryrefslogtreecommitdiffstats
path: root/test/T035-read-config.sh
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2020-11-07 21:58:32 -0400
committerDavid Bremner <david@tethera.net>2021-02-06 19:21:23 -0400
commit8588719eb1bb14367464214f304b6f93452124c7 (patch)
tree178b08ddef568b85dedb9a496cc569c6c2cec26b /test/T035-read-config.sh
parent0ab0b48be2d76c2c9b5581c1b66b21934b2025b7 (diff)
CLI/reply: convert to new config framework
This is messier than some of the other conversions because the extensive use of 'config' as a talloc context.
Diffstat (limited to 'test/T035-read-config.sh')
-rwxr-xr-xtest/T035-read-config.sh58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/T035-read-config.sh b/test/T035-read-config.sh
index 1e740eba..3da9cbe6 100755
--- a/test/T035-read-config.sh
+++ b/test/T035-read-config.sh
@@ -210,4 +210,62 @@ count2=$(notmuch count --lastmod '*' | cut -f3)
restore_config
test_expect_success "test '$count2 -gt $count1'"
+
+
+add_message '[from]="Sender <sender@example.com>"' \
+ [to]=test_suite@notmuchmail.org \
+ '[cc]="Other Parties <cc@example.com>"' \
+ [subject]=notmuch-reply-test \
+ '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+ '[body]="reply with CC"'
+
+cat <<EOF > EXPECTED
+Before:
+After:
+From: Notmuch Test Suite <test_suite@notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender@example.com>
+Cc: Other Parties <cc@example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender@example.com> wrote:
+> reply with CC
+EOF
+
+test_begin_subtest "reply with saved query from config file"
+backup_config
+query_name="test${RANDOM}"
+printf "Before:\n" > OUTPUT
+notmuch reply query:$query_name 2>&1 >> OUTPUT
+printf "\n[query]\n${query_name} = id:${gen_msg_id}\n" >> notmuch-config
+printf "After:\n" >> OUTPUT
+notmuch reply query:$query_name >> OUTPUT
+restore_config
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "reply with saved query from config file (xdg)"
+backup_config
+query_name="test${RANDOM}"
+xdg_config
+printf "Before:\n" > OUTPUT
+notmuch reply query:$query_name 2>&1 >> OUTPUT
+printf "\n[query]\n${query_name} = id:${gen_msg_id}\n" >> ${CONFIG_PATH}
+printf "After:\n" >> OUTPUT
+notmuch reply query:$query_name >> OUTPUT
+restore_config
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "reply with saved query from config file (xdg+profile)"
+backup_config
+query_name="test${RANDOM}"
+xdg_config $query_name
+printf "Before:\n" > OUTPUT
+notmuch reply query:$query_name 2>&1 >> OUTPUT
+printf "\n[query]\n${query_name} = id:${gen_msg_id}\n" >> ${CONFIG_PATH}
+printf "After:\n" >> OUTPUT
+notmuch reply query:$query_name >> OUTPUT
+restore_config
+test_expect_equal_file EXPECTED OUTPUT
+
test_done