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(): diff --git a/tests/test_query.py b/tests/test_query.py index ab9600eafb16760e4fadfc840fa0f62a1c8d667b..93f6315d272b7df35e55d934ea8485c665e4c440 100644 --- a/tests/test_query.py +++ b/tests/test_query.py @@ -165,13 +165,15 @@ def test_query2(): def test_query3(): body = get_connection().retrieve( entity_uri_segments=["Entity"], query_dict={ - "query": None}, reconnect=True).read() + "query": "bla"}, reconnect=True).read() + print(body) xml = etree.fromstring(body) assert xml.xpath("/Response/TransactionBenchmark") assert xml.xpath("/Response/Query") assert xml.xpath("/Response/UserInfo") assert xml.xpath("/Response/noscript") - assert 4 == len(xml) + assert xml.xpath("/Response/Error") + assert 5 == len(xml) @mark.slow