diff --git a/CHANGELOG.md b/CHANGELOG.md index fe6d35843f75ed3bc58e63cef687a3dde9a52345..a3fb12b079a2227fdc463dab05e588d54ae3d706 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/tests/test_issues_server.py b/tests/test_issues_server.py index 8b73d5e1890daba945e5c20008d9d4157d4b1dee..d0adc315379e0be1775d262bfa4f54e747c60654 100644 --- a/tests/test_issues_server.py +++ b/tests/test_issues_server.py @@ -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))