]> git.cworth.org Git - notmuch/commitdiff
test/message-property: convert python tests from legacy bindings
authorDavid Bremner <david@tethera.net>
Sat, 15 Feb 2025 19:22:53 +0000 (15:22 -0400)
committerDavid Bremner <david@tethera.net>
Sat, 22 Feb 2025 10:59:48 +0000 (06:59 -0400)
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.

test/T610-message-property.sh

index a7cbe04842a78a20827c06d4b5d5f825cf0807c7..04a5d488418155f84fd3dfbd1e0afe77c23a1b09 100755 (executable)
@@ -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