Skip to content
Snippets Groups Projects
Commit 3af22cc5 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files
parent 593a3acb
No related branches found
No related tags found
2 merge requests!175BUG: Request responses without the "Set-Cookie" header no longer overwrite the...,!165Compare_entities diff uses id instead of name where needed
Pipeline #58572 passed
......@@ -991,3 +991,31 @@ def test_describe_diff():
assert "first" not in diffout
assert "second" not in diffout
def test_diff_without_names():
"""Test compare_entities in case of properties and parents with
ids and without names
(cf. https://gitlab.com/linkahead/linkahead-pylib/-/issues/119).
"""
r1 = db.Record(name="Test").add_parent(name="TestType")
r2 = db.Record(name="Test").add_parent(name="TestType")
r2.add_property(id=123, value="Test")
diff1, diff2 = compare_entities(r1, r2)
assert len(diff1["properties"]) == 0
assert len(diff2["properties"]) == 1
assert 123 in diff2["properties"]
assert None not in diff2["properties"]
r3 = db.Record().add_parent(id=101)
r4 = db.Record().add_parent(id=102)
diff3, diff4 = compare_entities(r3, r4)
assert len(diff3["parents"]) == 1
assert 101 in diff3["parents"]
assert None not in diff3["parents"]
assert len(diff4["parents"]) == 1
assert 102 in diff4["parents"]
assert None not in diff3["parents"]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment