Skip to content
Snippets Groups Projects
Commit 39a73d99 authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

TST: added another test for insertion instead of update of identifiables

parent a6882d52
No related branches found
No related tags found
1 merge request!53Release 0.1
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment