Skip to content
Snippets Groups Projects
Commit 60b2af83 authored by florian's avatar florian
Browse files

TST: Add container error tests

parent accdda49
No related branches found
No related tags found
No related merge requests found
......@@ -120,6 +120,36 @@ def test_authorization_exception():
assert err.entity.name == ent.name
def test_empty_container_with_error():
"""Has to raise an error, even though container is empty."""
code = 0
cont = _add_error_message_to_entity(db.Container(), code)
with raises(TransactionError) as e:
raise_errors(cont)
# No entity errors
assert len(e.value.errors) == 0
assert e.value.get_container() == cont
assert int(e.value.get_code()) == code
def test_faulty_container_with_healthy_entities():
"""Raises a TransactionError without any EntityErrors since only the
container, but none of its entities has an error.
"""
code = 0
cont = _add_error_message_to_entity(db.Container(), code)
cont.append(db.Entity("TestHealthyEnt1"))
cont.append(db.Entity("TestHealthyEnt2"))
with raises(TransactionError) as e:
raise_errors(cont)
# No entity errors
assert len(e.value.errors) == 0
assert len(e.value.entities) == 0
assert e.value.get_container() == cont
assert int(e.value.get_code()) == code
# #################### Children with children ####################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment