Skip to content
Snippets Groups Projects
Commit c35eb3af authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

ENH: Include container error code

parent 6d6a21e5
No related branches found
No related tags found
No related merge requests found
...@@ -204,11 +204,12 @@ def test_parent_and_properties_errors(): ...@@ -204,11 +204,12 @@ def test_parent_and_properties_errors():
def test_container_with_faulty_elements(): def test_container_with_faulty_elements():
"""Container with valid and invalid entities. All faulty entities have """Code 12; container with valid and invalid entities. All faulty
to be reflected correctly in the errors list of the entities have to be reflected correctly in the errors list of the
TransactionError raised by the container. TransactionError raised by the container.
""" """
container_code = 12
prop_code = 114 prop_code = 114
parent_code = 116 parent_code = 116
name_code = 152 name_code = 152
...@@ -222,7 +223,8 @@ def test_container_with_faulty_elements(): ...@@ -222,7 +223,8 @@ def test_container_with_faulty_elements():
name="TestProp1"), entity_code) name="TestProp1"), entity_code)
prop2 = _add_error_message_to_entity(db.Property( prop2 = _add_error_message_to_entity(db.Property(
name="TestProp2"), no_entity_code) name="TestProp2"), no_entity_code)
cont = db.Container() cont = _add_error_message_to_entity(db.Container(),
container_code)
# healthy record and property # healthy record and property
good_rec = db.Record(name="TestRecord1") good_rec = db.Record(name="TestRecord1")
good_prop = db.Property(name="TestProp3") good_prop = db.Property(name="TestProp3")
...@@ -242,6 +244,15 @@ def test_container_with_faulty_elements(): ...@@ -242,6 +244,15 @@ def test_container_with_faulty_elements():
raise_errors(cont) raise_errors(cont)
# TODO: Check whether all errors and all broken entities are # TODO: Check whether all errors and all broken entities are
# listed correctly. The healthy entities must not appear. # listed correctly. The healthy entities must not appear.
te = e.value
# only container on first level:
assert len(te.errors) == 1
ce = te.errors[0]
assert isinstance(ce, ContainerError)
# no healthy entity caused an error
for good in [good_rec, good_prop]:
assert not good in te.all_errors
def test_convenience_functions(): def test_convenience_functions():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment