aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2025-02-15 15:22:53 -0400
committerDavid Bremner <david@tethera.net>2025-02-22 06:59:48 -0400
commit58ea60c2e49fb7881046829141a7a795d1a3ffca (patch)
tree74a0c91205b03c080ed2f0ffb57512537083fe18 /test
parent145be20b0d54ab7cdd1829b2da16e7fb0fd3e775 (diff)
test/message-property: convert python tests from legacy bindings
One test is deleted since that method is not provided by the new bindings. Similar things can be done by accessing the PropertiesMap returned by properties. This change is a prelude to removing the legacy bindings from the build.
Diffstat (limited to 'test')
-rwxr-xr-xtest/T610-message-property.sh44
1 files changed, 15 insertions, 29 deletions
diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh
index a7cbe048..04a5d488 100755
--- a/test/T610-message-property.sh
+++ b/test/T610-message-property.sh
@@ -299,26 +299,12 @@ id:4EFC743A.3060609@april.org
EOF
test_expect_equal_file EXPECTED OUTPUT
-test_begin_subtest "msg.get_property (python)"
+test_begin_subtest "msg.properties (python)"
test_python <<'EOF'
-import notmuch
-db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)
-msg = db.find_message("4EFC743A.3060609@april.org")
-print("testkey1 = {0}".format(msg.get_property("testkey1")))
-print("testkey3 = {0}".format(msg.get_property("testkey3")))
-EOF
-cat <<'EOF' > EXPECTED
-testkey1 = alice
-testkey3 = alice3
-EOF
-test_expect_equal_file EXPECTED OUTPUT
-
-test_begin_subtest "msg.get_properties (python)"
-test_python <<'EOF'
-import notmuch
-db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
-msg = db.find_message("4EFC743A.3060609@april.org")
-for (key,val) in msg.get_properties("testkey1"):
+import notmuch2
+db = notmuch2.Database(mode=notmuch2.Database.MODE.READ_ONLY)
+msg = db.find("4EFC743A.3060609@april.org")
+for (key,val) in msg.properties.getall("testkey1"):
print("{0} = {1}".format(key,val))
EOF
cat <<'EOF' > EXPECTED
@@ -328,12 +314,12 @@ testkey1 = testvalue2
EOF
test_expect_equal_file EXPECTED OUTPUT
-test_begin_subtest "msg.get_properties (python, prefix)"
+test_begin_subtest "msg.properties (python, prefix)"
test_python <<'EOF'
-import notmuch
-db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
-msg = db.find_message("4EFC743A.3060609@april.org")
-for (key,val) in msg.get_properties("testkey"):
+import notmuch2
+db = notmuch2.Database(mode=notmuch2.Database.MODE.READ_ONLY)
+msg = db.find("4EFC743A.3060609@april.org")
+for (key,val) in msg.properties.getall("testkey"):
print("{0} = {1}".format(key,val))
EOF
cat <<'EOF' > EXPECTED
@@ -346,12 +332,12 @@ testkey3 = testvalue3
EOF
test_expect_equal_file EXPECTED OUTPUT
-test_begin_subtest "msg.get_properties (python, exact)"
+test_begin_subtest "msg.properties (python, exact)"
test_python <<'EOF'
-import notmuch
-db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
-msg = db.find_message("4EFC743A.3060609@april.org")
-for (key,val) in msg.get_properties("testkey",True):
+import notmuch2
+db = notmuch2.Database(mode=notmuch2.Database.MODE.READ_ONLY)
+msg = db.find("4EFC743A.3060609@april.org")
+for (key,val) in msg.properties("testkey",True):
print("{0} = {1}".format(key,val))
EOF
test_expect_equal_file /dev/null OUTPUT