From b35d9ce93cbf8cf05ee7cfe0d8638cda77b38ae6 Mon Sep 17 00:00:00 2001 From: fspreck <f.spreckelsen@indiscale.com> Date: Fri, 3 Jul 2020 16:54:45 +0200 Subject: [PATCH] TST: Finsh sketch of unittests --- unittests/test_error_handling.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/unittests/test_error_handling.py b/unittests/test_error_handling.py index 1ff596b4..e2e71085 100644 --- a/unittests/test_error_handling.py +++ b/unittests/test_error_handling.py @@ -251,8 +251,19 @@ def test_container_with_faulty_elements(): assert isinstance(ce, ContainerError) # no healthy entity caused an error for good in [good_rec, good_prop]: - assert not good in te.all_errors - + assert not good in te.all_entities + # all records that caused problems + assert {rec_name, rec_auth, rec_par_prop}.issubset(te.all_entities) + # the container error contains the errors caused by the records + for err in ce.errors: + if err.entity.name == rec_name.name: + assert isinstance(err, UniqueNamesError) + elif err.entity.name == rec_auth.name: + assert isinstance(err, AuthorizationException) + elif err.entity.name == rec_par_prop.name: + # record raises both of them + assert (isinstance(err, UnqualifiedParentsError) or + isinstance(err, UnqualifiedPropertiesError)) def test_convenience_functions(): -- GitLab