Skip to content
Snippets Groups Projects
Commit 611d48f7 authored by florian's avatar florian
Browse files

TST: Adapt test_version.py to new error handling

parent e53c809e
Branches
Tags
No related merge requests found
...@@ -205,10 +205,10 @@ def test_retrieve_relative_to_head(): ...@@ -205,10 +205,10 @@ def test_retrieve_relative_to_head():
assert first_version == rt_head.version, "head is first version" assert first_version == rt_head.version, "head is first version"
# no HEAD~1 before first update # no HEAD~1 before first update
with raises(c.EntityDoesNotExistError) as exc: with raises(c.TransactionError) as exc:
# no head~2 # no head~2
c.Container().retrieve(query=str(rt.id) + "@HEAD~1", sync=False) c.Container().retrieve(query=str(rt.id) + "@HEAD~1", sync=False)
assert exc.value.has_error(c.EntityDoesNotExistError)
# update # update
rt.description = "TestDescription4" rt.description = "TestDescription4"
rt.update() rt.update()
...@@ -237,9 +237,10 @@ def test_retrieve_relative_to_head(): ...@@ -237,9 +237,10 @@ def test_retrieve_relative_to_head():
assert rt_pre_head.version.successors[0].id == rt_new_head.version.id, ( assert rt_pre_head.version.successors[0].id == rt_new_head.version.id, (
"successor of head~1 is head") "successor of head~1 is head")
with raises(c.EntityDoesNotExistError) as exc: with raises(c.TransactionError) as exc:
# no head~2 # no head~2
c.Container().retrieve(query=str(rt.id) + "@HEAD~2", sync=False) c.Container().retrieve(query=str(rt.id) + "@HEAD~2", sync=False)
assert exc.value.has_error(c.EntityDoesNotExistError)
@mark.xfail(reason="bug fix needed") @mark.xfail(reason="bug fix needed")
...@@ -256,9 +257,10 @@ def test_bug_cached_delete(): ...@@ -256,9 +257,10 @@ def test_bug_cached_delete():
c.execute_query("FIND RecordType TestRT").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, c.Container().retrieve(query=str(rt.id) + "@" + old_version,
sync=False)[0] sync=False)[0]
assert exc.value.has_error(c.EntityDoesNotExistError)
@mark.xfail(reason=("TODO: What is the desired behavior? " @mark.xfail(reason=("TODO: What is the desired behavior? "
...@@ -420,7 +422,7 @@ def test_reference_deleted_in_old_version(): ...@@ -420,7 +422,7 @@ def test_reference_deleted_in_old_version():
rec.remove_property(ref_rt) rec.remove_property(ref_rt)
rec.update() rec.update()
with raises(c.EntityDoesNotExistError) as exc: with raises(c.EmptyUniqueQueryError) as exc:
c.execute_query( c.execute_query(
"FIND RECORD TestRec2 WHICH REFERENCES {}".format( "FIND RECORD TestRec2 WHICH REFERENCES {}".format(
referenced_rec.id), referenced_rec.id),
...@@ -461,12 +463,13 @@ def test_reference_deleted_in_old_version(): ...@@ -461,12 +463,13 @@ def test_reference_deleted_in_old_version():
assert old_rec.get_property(p).value == "blablabla" 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 == referenced_id
with raises(c.EntityDoesNotExistError) as exc: with raises(c.EmptyUniqueQueryError) as exc:
c.execute_query("FIND ENTITY WITH ID = {}".format(referenced_id), c.execute_query("FIND ENTITY WITH ID = {}".format(referenced_id),
unique=True) unique=True)
with raises(c.EntityDoesNotExistError) as exc: with raises(c.TransactionError) as exc:
c.Record(id=referenced_id).retrieve() c.Record(id=referenced_id).retrieve()
assert exc.value.has_error(c.EntityDoesNotExistError)
def test_reference_version_head(): def test_reference_version_head():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment