]> git.notmuchmail.org Git - notmuch/blob - test/T040-setup.sh
test/setup: add check for config exists, but no database.
[notmuch] / test / T040-setup.sh
1 #!/usr/bin/env bash
2
3 test_description='"notmuch setup"'
4 . $(dirname "$0")/test-lib.sh || exit 1
5
6 test_begin_subtest "Notmuch new without a config suggests notmuch setup"
7 output=$(notmuch --config=new-notmuch-config new 2>&1)
8 test_expect_equal "$output" "\
9 Error: cannot load config file.
10 Try running 'notmuch setup' to create a configuration."
11
12 test_begin_subtest "Create a new config interactively"
13 notmuch --config=new-notmuch-config > /dev/null <<EOF
14 Test Suite
15 test.suite@example.com
16 another.suite@example.com
17
18 /path/to/maildir
19 foo bar
20 baz
21 EOF
22
23 output=$(notmuch --config=new-notmuch-config config list | notmuch_built_with_sanitize)
24 test_expect_equal "$output" "\
25 database.path=/path/to/maildir
26 user.name=Test Suite
27 user.primary_email=test.suite@example.com
28 user.other_email=another.suite@example.com;
29 new.tags=foo;bar;
30 new.ignore=
31 search.exclude_tags=baz;
32 maildir.synchronize_flags=true
33 built_with.compact=something
34 built_with.field_processor=something
35 built_with.retry_lock=something"
36
37 test_begin_subtest "notmuch with a config but without a database suggests notmuch new"
38 notmuch 2>&1 | notmuch_dir_sanitize > OUTPUT
39 cat <<EOF > EXPECTED
40 Notmuch is configured, but there's not yet a database at
41
42         MAIL_DIR/.notmuch
43
44 You probably want to run "notmuch new" now to create that database.
45
46 Note that the first run of "notmuch new" can take a very long time
47 and that the resulting database will use roughly the same amount of
48 storage space as the email being indexed.
49
50 EOF
51 test_expect_equal_file EXPECTED OUTPUT
52
53 test_done