diff --git a/tests/test_version.py b/tests/test_version.py index 4abf10a19f8e4c059334d5e247b0aae59738f395..4d19aaae7d90c808b891042cc78484fba85bddcb 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -429,6 +429,7 @@ def test_bug_parent_name_in_old_version(): assert [OLD_NAME] == [p.name for p in rec_v1.get_parents()] +@mark.xfail(reason="fix https://gitlab.com/caosdb/caosdb-server/-/issues/178") def test_reference_deleted_in_old_version(): ref_rt = insertion("TestReferencedObject") rt = insertion("TestRT") @@ -491,14 +492,23 @@ def test_reference_deleted_in_old_version(): assert test_rec.get_property(ref_rt) is None assert test_rec.version.predecessors[0].id == old_version - # retrieve old version again. the reference (to the now deleted entity) - # is still there. + # retrieve old version again (cache on). the reference (to the now deleted + # entity) is still there. old_rec = c.Container().retrieve(str(test_rec.id) + "@HEAD~1", sync=False)[0] assert old_rec.version.id == old_version assert old_rec.version.successors[0].id == test_rec.version.id assert old_rec.get_property(p).value == "blablabla" - assert old_rec.get_property(ref_rt).value == referenced_id + assert old_rec.get_property(ref_rt).value is None, "TODO this fails" + + # retrieve old version again (cache off). the reference (to the now deleted + # entity) is NOT there + old_rec = c.Container().retrieve(str(test_rec.id) + "@HEAD~1", + sync=False, flags={"cache": "false"})[0] + assert old_rec.version.id == old_version + assert old_rec.version.successors[0].id == test_rec.version.id + assert old_rec.get_property(p).value == "blablabla" + assert old_rec.get_property(ref_rt).value is None with raises(c.EmptyUniqueQueryError) as exc: c.execute_query("FIND ENTITY WITH ID = {}".format(referenced_id),