From 3e2cd9e1f9ddedf3830128dc914539472407b91a Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Fri, 1 Sep 2023 09:18:54 +0200 Subject: [PATCH] TEST: Testing for "Datatype of old properties is changed" This is https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/106 --- tests/test_issues_server.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test_issues_server.py b/tests/test_issues_server.py index 9a54058..7762838 100644 --- a/tests/test_issues_server.py +++ b/tests/test_issues_server.py @@ -1402,3 +1402,33 @@ See https://gitlab.com/caosdb/caosdb-server/-/issues/220""" assert res_3.parents[0].name == rectype.name, \ "The name of the record's parent should be up-to-date." assert query.cached is False, "Query after name change of parent should not be cached." + + +@pytest.mark.xfail(reason="Needs fix for keeping datatype, " + "see https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/106") +def test_indiscale_106(): + """Datatype of old properties is changed. + +See https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/106 + """ + + # Create TEXT Property + p = db.Property("prop", datatype=db.TEXT) + p.insert() + + # Create Record using this Property + db.RecordType("RT").insert() + r = db.Record(name="rec") + r.add_parent("RT") + r.add_property(id=p.id, value="This is a TEXT property") + r.insert() + + print(db.Record(id=r.id).retrieve()) + assert db.Record(id=r.id).retrieve().get_property("prop").datatype == db.TEXT + + # Changing Property's datatype to REFERENCE + p.datatype = db.REFERENCE + p.update() + + # Existing Property should still be reported as TEXT + assert db.Record(id=r.id).retrieve().get_property("prop").datatype == db.TEXT -- GitLab