From b0ca3f20886796b1bb1aac6d1d996c3be603b8b0 Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Fri, 18 Nov 2022 17:06:11 +0100
Subject: [PATCH] TST: update tests for server issue
 https://gitlab.com/caosdb/caosdb-server/-/issues/136

---
 tests/test_issues_server.py | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/tests/test_issues_server.py b/tests/test_issues_server.py
index 3afb047..9ca60a1 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():
-- 
GitLab