Skip to content
Snippets Groups Projects
Commit aeacf439 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'f-bug-fit-95-obligatory-property-xfail' into 'dev'

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

See merge request !85
parents 2c20954e e34a2059
Branches
Tags
1 merge request!85TST: Added test for https://gitlab.com/linkahead/linkahead-server/-/issues/280 and update changelog
Pipeline #59677 failed
......@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added (for new features)
* Tests for [linkahead-server#280](https://gitlab.com/linkahead/linkahead-server/-/issues/280)
* Test for [caosdb-pylib#119](https://gitlab.com/linkahead/linkahead-pylib/-/issues/119)
* Test for [caosdb-pylib#89](https://gitlab.com/linkahead/linkahead-pylib/-/issues/89)
* Test for [caosdb-pylib#103](https://gitlab.com/linkahead/linkahead-pylib/-/issues/103)
......
......@@ -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))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment