Skip to content
Snippets Groups Projects

TST: Added test for https://gitlab.com/linkahead/linkahead-server/-/issues/280 and update changelog

Merged I. Nüske requested to merge f-bug-fit-95-obligatory-property-xfail into dev
2 files
+ 23
0
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -1588,3 +1588,25 @@ def test_268_insert_nonexistent_file():
with pytest.raises(TransactionError) as tre:
db.File(path='IDoNotExist').insert()
assert repr(tre) == "File does not exist: IDoNotExist" # TODO Replace by proper string.
@pytest.mark.xfail(reason="https://gitlab.com/linkahead/linkahead-server/-/issues/280")
def test_issue_280():
"""
Test that the error message returned when an obligatory property is missing
contains information on the missing property.
See https://gitlab.com/linkahead/linkahead-server/-/issues/280
"""
prop = db.Property(name="TestProp", datatype=db.TEXT)
prop.insert()
rt = db.RecordType(name="TestRT")
rt.add_property(prop, importance=db.OBLIGATORY)
rt.insert()
# Check that error message contains name or id of missing property
rec = db.Record(name="TestRec").add_parent(rt)
with pytest.raises(TransactionError) as e:
rec.insert()
assert (prop.name in str(e.value)) or (str(prop.id) in str(e.value))
Loading