test: basic: drop 'ensure all available tests are run'
[notmuch] / test / python
1 #!/usr/bin/env bash
2 test_description="python bindings"
3 . ./test-lib.sh
4
5 add_email_corpus
6
7 test_begin_subtest "compare thread ids"
8 test_python <<EOF
9 import notmuch
10 db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
11 q_new = notmuch.Query(db, 'tag:inbox')
12 q_new.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
13 for t in q_new.search_threads():
14     print t.get_thread_id()
15 EOF
16 notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
17 test_expect_equal_file OUTPUT EXPECTED
18
19 test_begin_subtest "compare message ids"
20 test_python <<EOF
21 import notmuch
22 db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
23 q_new = notmuch.Query(db, 'tag:inbox')
24 q_new.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
25 for m in q_new.search_messages():
26     print m.get_message_id()
27 EOF
28 notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
29 test_expect_equal_file OUTPUT EXPECTED
30
31 test_begin_subtest "get non-existent file"
32 test_python <<EOF
33 import notmuch
34 db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
35 print db.find_message_by_filename("i-dont-exist")
36 EOF
37 test_expect_equal "$(cat OUTPUT)" "None"
38
39 test_done