2011-12-05 02:50:08 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
test_description="python bindings"
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
2015-08-02 08:40:55 +02:00
|
|
|
test_require_external_prereq ${NOTMUCH_PYTHON}
|
|
|
|
|
2011-12-05 02:50:08 +01:00
|
|
|
add_email_corpus
|
|
|
|
|
|
|
|
test_begin_subtest "compare thread ids"
|
2011-12-07 10:46:17 +01:00
|
|
|
test_python <<EOF
|
2011-12-05 02:50:08 +01:00
|
|
|
import notmuch
|
2012-01-02 15:51:26 +01:00
|
|
|
db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
|
2011-12-05 02:50:08 +01:00
|
|
|
q_new = notmuch.Query(db, 'tag:inbox')
|
2012-01-02 15:51:26 +01:00
|
|
|
q_new.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
|
2011-12-05 02:50:08 +01:00
|
|
|
for t in q_new.search_threads():
|
2015-05-23 22:28:44 +02:00
|
|
|
print (t.get_thread_id())
|
2011-12-05 02:50:08 +01:00
|
|
|
EOF
|
2012-01-02 15:51:26 +01:00
|
|
|
notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
|
|
|
|
test_expect_equal_file OUTPUT EXPECTED
|
2012-01-02 15:51:27 +01:00
|
|
|
|
|
|
|
test_begin_subtest "compare message ids"
|
|
|
|
test_python <<EOF
|
|
|
|
import notmuch
|
|
|
|
db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
|
|
|
|
q_new = notmuch.Query(db, 'tag:inbox')
|
|
|
|
q_new.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
|
|
|
|
for m in q_new.search_messages():
|
2015-05-23 22:28:44 +02:00
|
|
|
print (m.get_message_id())
|
2012-01-02 15:51:27 +01:00
|
|
|
EOF
|
|
|
|
notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
|
|
|
|
test_expect_equal_file OUTPUT EXPECTED
|
|
|
|
|
2012-05-18 06:13:41 +02:00
|
|
|
test_begin_subtest "get non-existent file"
|
|
|
|
test_python <<EOF
|
|
|
|
import notmuch
|
|
|
|
db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
|
2015-05-23 22:28:44 +02:00
|
|
|
print (db.find_message_by_filename("i-dont-exist"))
|
2012-05-18 06:13:41 +02:00
|
|
|
EOF
|
|
|
|
test_expect_equal "$(cat OUTPUT)" "None"
|
|
|
|
|
2011-12-05 02:50:08 +01:00
|
|
|
test_done
|