From e08869837ed237fddfb4ba74aafe157df3808490 Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Thu, 3 Mar 2022 18:53:07 +0100
Subject: [PATCH] TEST: Test for server issue 217: faulty list property XML.

Server gets list property datatype wrong if description is updated

caosdb/src/caosdb-server#217
---
 tests/test_issues_server.py | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/tests/test_issues_server.py b/tests/test_issues_server.py
index 844de46..ba2f31a 100644
--- a/tests/test_issues_server.py
+++ b/tests/test_issues_server.py
@@ -1,10 +1,8 @@
 # -*- coding: utf-8 -*-
-#
-# ** header v3.0
 # This file is a part of the CaosDB Project.
 #
-# Copyright (c) 2020 IndiScale GmbH <info@indiscale.com>
-# Copyright (c) 2020 Daniel Hornung <d.hornung@indiscale.com>
+# Copyright (c) 2022 IndiScale GmbH <info@indiscale.com>
+# Copyright (c) 2022 Daniel Hornung <d.hornung@indiscale.com>
 # Copyright (c) 2020 Florian Spreckelsen <f.spreckelsen@indiscale.com>
 #
 # This program is free software: you can redistribute it and/or modify
@@ -19,8 +17,6 @@
 #
 # You should have received a copy of the GNU Affero General Public License
 # along with this program. If not, see <https://www.gnu.org/licenses/>.
-#
-# ** end header
 
 """Tests for issues on gitlab.com, project caosdb-server."""
 
@@ -603,3 +599,17 @@ def test_issue_132():
     # this one has the wront scope of the conjunction.
     query = "FIND RECORD TestRT WITH TestRT_Foo.TestP_Bar = val1 AND TestP_Baz = 'the other one'"
     assert len(db.execute_query(query)) == 0
+
+
+def test_issue_217():
+    """Server gets list property datatype wrong if description is updated."""
+
+    rt = db.RecordType(name="TestRT").insert()
+    # prop = db.Property(name="LP", datatype=db.LIST("TestRT")).insert()
+    r = db.Record().add_parent(id=rt.id).add_property(name=rt.name,
+                                                      datatype=db.LIST(db.INTEGER),
+                                                      value=[1, 2]).insert()
+    r.retrieve()
+    r.description = "Changed description"
+    r.update()
+    r.retrieve()                # This line fails in the bug report with invalid XML.
-- 
GitLab