diff --git a/tests/test_issues_server.py b/tests/test_issues_server.py index 3afb0474ff52233c07ee76089b5811d58c35a964..9ca60a1aa97a124198553f28f9a584fe5b577808 100644 --- a/tests/test_issues_server.py +++ b/tests/test_issues_server.py @@ -804,7 +804,41 @@ def test_136(): te = err.value assert te.has_error(db.UnqualifiedPropertiesError) - assert "Cannot parse value to integer" in str(te) + assert "This data type does not accept collections of values (e.g. Lists)" in str(te) + + +@pytest.mark.xfail(reason="Fix https://gitlab.com/caosdb/caosdb-pylib/-/issues/81") +def test_136_b(): + """Faulty creation of a multi-property when updating a non-list property + with a list value. + + https://gitlab.com/caosdb/caosdb-server/-/issues/136 + + """ + # @author Florian Spreckelsen + # @date 2022-05-23 + + # Insert data model: + rt = db.RecordType(name="TestBug") + p = db.Property(name="TestBugProperty", datatype=db.TEXT) + db.Container().extend([rt, p]).insert() + + # Insert test record: + r = db.Record(name="TestRecord") + r.add_parent(rt) + r.add_property(p, value="val1") + r.insert() + + # Update the record: + test_r = db.Record(id=r.id).retrieve() + test_r.add_parent(rt) + test_r.add_property(id=p.id, value=["val1", "val2"]) + with pytest.raises(db.TransactionError) as err: + test_r.update() + + te = err.value + assert te.has_error(db.UnqualifiedPropertiesError) + assert "This data type does not accept collections of values (e.g. Lists)" in str(te) def test_141():