Skip to content
Snippets Groups Projects
Commit 15b2e3f1 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files
parent 0d809f8d
No related branches found
No related tags found
No related merge requests found
Pipeline #52799 passed
......@@ -90,3 +90,34 @@ def test_gitlab_com_108():
tests = db.execute_query("FIND ENTITY test*", cache=False)
tests.delete()
print("deleted")
def test_gitlab_com_120():
"""Test that an update doesn't add unwanted subproperties.
See https://gitlab.com/linkahead/linkahead-pylib/-/issues/120.
"""
rt1 = db.RecordType(name="TestType1")
rt2 = db.RecordType(name="TestType2")
prop = db.Property(name="TestProp", datatype=db.TEXT)
rt2.add_property(prop)
rt1.add_property(rt2)
# no subproperties in rt1's rt2 property:
assert len(rt1.get_property(rt2.name).properties) == 0
db.Container().extend([rt1, rt2, prop]).insert()
rt1_retrieved = db.RecordType(id=rt1.id).retrieve()
# Also no subproperties after retrieval
assert len(rt1_retrieved.get_property(rt2.name).properties) == 0
new_prop = db.Property(name="TestPropNew", datatype=db.INTEGER).insert()
rt1_retrieved.add_property(new_prop)
# Still no subproperties
assert len(rt1_retrieved.get_property(rt2.name).properties) == 0
rt1_retrieved.update()
# The update and addition of a new property must not change this, either.
assert len(rt1_retrieved.get_property(rt2.name).properties) == 0
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