diff --git a/integrationtests/test.py b/integrationtests/test.py index a5654fb5ba9d3d7caa40ff73725c253118ee99c2..b84e9f888abb8017cd5fde2f7430371e6562a377 100755 --- a/integrationtests/test.py +++ b/integrationtests/test.py @@ -153,14 +153,46 @@ def test_identifiable_update(clear_database, usemodel, ident, crawler): cr = Crawler(debug=True, identifiableAdapter=ident) crawl_standard_test_directory(cr) + # Test the addition of a single property: l = cr.updateList for record in l: - if record.parents[0].name == "Measurement": + if (record.parents[0].name == "Measurement" and + record.get_property("date").value == "2020-01-03"): # maybe a bit weird, but add an email address to a measurement record.add_property(name="email", value="testperson@testaccount.test") print("one change") break - breakpoint() ins, ups = cr.synchronize() assert len(ins) == 0 assert len(ups) == 1 + + + # Test the change within one property: + cr = Crawler(debug=True, identifiableAdapter=ident) + crawl_standard_test_directory(cr) + l = cr.updateList + for record in l: + if (record.parents[0].name == "Measurement" and + record.get_property("date").value == "2020-01-03"): + record.add_property(name="email", value="testperson@coolmail.test") + print("one change") + break + ins, ups = cr.synchronize() + assert len(ins) == 0 + assert len(ups) == 1 + + # Changing the date should result in a new insertion: + cr = Crawler(debug=True, identifiableAdapter=ident) + crawl_standard_test_directory(cr) + l = cr.updateList + for record in l: + if (record.parents[0].name == "Measurement" and + record.get_property("date").value == "2020-01-03"): + record.add_property(name="email", value="testperson@coolmail.test") + record.get_property("date").value = "2012-01-02" + print("one change") + break + breakpoint() + ins, ups = cr.synchronize() + assert len(ins) == 1 + assert len(ups) == 0