diff options
| author | David Bremner <david@tethera.net> | 2020-08-26 08:43:33 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-02-06 19:17:34 -0400 |
| commit | f994f0e7df178eb31c656329bb28ffa832ac4364 (patch) | |
| tree | 45f5c587b3369b8600d8ffff7cbadc0ef20aeaac /test | |
| parent | 66adcd4f538d426205fd09b0f97b63c74e9e82d7 (diff) | |
CLI/insert: convert to new config framework.
The new talloc context is needed to run the hook at the very end of
the function. That in turn is needed so that this process gives up the
write lock on the database.
Diffstat (limited to 'test')
| -rwxr-xr-x | test/T035-read-config.sh | 38 | ||||
| -rwxr-xr-x | test/T070-insert.sh | 8 |
2 files changed, 43 insertions, 3 deletions
diff --git a/test/T035-read-config.sh b/test/T035-read-config.sh index 35fbd600..0aa2e553 100755 --- a/test/T035-read-config.sh +++ b/test/T035-read-config.sh @@ -142,4 +142,42 @@ notmuch dump > OUTPUT restore_config test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "Insert message with custom new.tags (xdg)" +backup_config +xdg_config +tag=test${RANDOM} +notmuch --config=${CONFIG_PATH} config set new.tags $tag +generate_message \ + "[subject]=\"insert-subject\"" \ + "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \ + "[body]=\"insert-message\"" +mkdir -p ${MAIL_DIR}/{cur,new,tmp} +notmuch insert < "$gen_msg_filename" +notmuch dump id:$gen_msg_id > OUTPUT +cat <<EOF > EXPECTED +#notmuch-dump batch-tag:3 config,properties,tags ++$tag -- id:$gen_msg_id +EOF +restore_config +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "Insert message with custom new.tags (xdg+profile)" +backup_config +tag=test${RANDOM} +xdg_config $tag +notmuch --config=${CONFIG_PATH} config set new.tags $tag +generate_message \ + "[subject]=\"insert-subject\"" \ + "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" \ + "[body]=\"insert-message\"" +mkdir -p ${MAIL_DIR}/{cur,new,tmp} +notmuch insert < "$gen_msg_filename" +notmuch dump id:$gen_msg_id > OUTPUT +cat <<EOF > EXPECTED +#notmuch-dump batch-tag:3 config,properties,tags ++$tag -- id:$gen_msg_id +EOF +restore_config +test_expect_equal_file EXPECTED OUTPUT + test_done diff --git a/test/T070-insert.sh b/test/T070-insert.sh index 1c7ca846..7341810c 100755 --- a/test/T070-insert.sh +++ b/test/T070-insert.sh @@ -226,11 +226,13 @@ test_expect_code 1 "notmuch insert --folder=../G --create-folder < $gen_msg_file OLDCONFIG=$(notmuch config get new.tags) -test_begin_subtest "Empty tags in new.tags are forbidden" +test_begin_subtest "Empty tags in new.tags are ignored" notmuch config set new.tags "foo;;bar" gen_insert_msg -output=$(notmuch insert < $gen_msg_filename 2>&1) -test_expect_equal "$output" "Error: tag '' in new.tags: empty tag forbidden" +notmuch insert < $gen_msg_filename +output=$(notmuch show --format=json id:$gen_msg_id) +test_json_nodes <<<"$output" \ + 'new_tags:[0][0][0]["tags"] = ["bar", "foo"]' test_begin_subtest "Tags starting with '-' in new.tags are forbidden" notmuch config set new.tags "-foo;bar" |
