From 611d48f72d192039fcc10b6481da0f291df7822f Mon Sep 17 00:00:00 2001
From: florian <f.spreckelsen@inidscale.com>
Date: Tue, 22 Sep 2020 12:49:02 +0200
Subject: [PATCH] TST: Adapt test_version.py to new error handling

---
 tests/test_version.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/tests/test_version.py b/tests/test_version.py
index 40f0cc6..b3b0a5c 100644
--- a/tests/test_version.py
+++ b/tests/test_version.py
@@ -205,10 +205,10 @@ def test_retrieve_relative_to_head():
     assert first_version == rt_head.version, "head is first version"
 
     # no HEAD~1 before first update
-    with raises(c.EntityDoesNotExistError) as exc:
+    with raises(c.TransactionError) as exc:
         # no head~2
         c.Container().retrieve(query=str(rt.id) + "@HEAD~1", sync=False)
-
+    assert exc.value.has_error(c.EntityDoesNotExistError)
     # update
     rt.description = "TestDescription4"
     rt.update()
@@ -237,9 +237,10 @@ def test_retrieve_relative_to_head():
     assert rt_pre_head.version.successors[0].id == rt_new_head.version.id, (
         "successor of head~1 is head")
 
-    with raises(c.EntityDoesNotExistError) as exc:
+    with raises(c.TransactionError) as exc:
         # no head~2
         c.Container().retrieve(query=str(rt.id) + "@HEAD~2", sync=False)
+    assert exc.value.has_error(c.EntityDoesNotExistError)
 
 
 @mark.xfail(reason="bug fix needed")
@@ -256,9 +257,10 @@ def test_bug_cached_delete():
 
     c.execute_query("FIND RecordType TestRT").delete()
 
-    with raises(c.EntityDoesNotExistError) as exc:
+    with raises(c.TransactionError) as exc:
         c.Container().retrieve(query=str(rt.id) + "@" + old_version,
                                sync=False)[0]
+    assert exc.value.has_error(c.EntityDoesNotExistError)
 
 
 @mark.xfail(reason=("TODO: What is the desired behavior? "
@@ -420,7 +422,7 @@ def test_reference_deleted_in_old_version():
     rec.remove_property(ref_rt)
     rec.update()
 
-    with raises(c.EntityDoesNotExistError) as exc:
+    with raises(c.EmptyUniqueQueryError) as exc:
         c.execute_query(
             "FIND RECORD TestRec2 WHICH REFERENCES {}".format(
                 referenced_rec.id),
@@ -461,12 +463,13 @@ def test_reference_deleted_in_old_version():
     assert old_rec.get_property(p).value == "blablabla"
     assert old_rec.get_property(ref_rt).value == referenced_id
 
-    with raises(c.EntityDoesNotExistError) as exc:
+    with raises(c.EmptyUniqueQueryError) as exc:
         c.execute_query("FIND ENTITY WITH ID = {}".format(referenced_id),
                         unique=True)
 
-    with raises(c.EntityDoesNotExistError) as exc:
+    with raises(c.TransactionError) as exc:
         c.Record(id=referenced_id).retrieve()
+    assert exc.value.has_error(c.EntityDoesNotExistError)
 
 
 def test_reference_version_head():
-- 
GitLab