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

BUG: Fix typos, add xfails

parent 19095398
No related branches found
No related tags found
No related merge requests found
...@@ -33,8 +33,11 @@ from caosdb.exceptions import (AmbiguityException, ...@@ -33,8 +33,11 @@ from caosdb.exceptions import (AmbiguityException,
AuthorizationException, ContainerError, AuthorizationException, ContainerError,
EntityDoesNotExistError, EntityError, EntityDoesNotExistError, EntityError,
EntityHasNoDatatypeError, EntityHasNoDatatypeError,
TransactionError, UniqueNamesError) TransactionError, UniqueNamesError,
UnqualifiedParentsError,
UnqualifiedPropertiesError)
import pytest # TODO: remove when xfails have been dealt with
from pytest import raises from pytest import raises
...@@ -47,7 +50,7 @@ def _add_error_message_to_entity(entity, code, description="Error message"): ...@@ -47,7 +50,7 @@ def _add_error_message_to_entity(entity, code, description="Error message"):
description=description) description=description)
entity.add_message(message) entity.add_message(message)
return enetity return entity
def test_has_no_datatype_error(): def test_has_no_datatype_error():
...@@ -86,7 +89,7 @@ def test_entity_error(): ...@@ -86,7 +89,7 @@ def test_entity_error():
ent = _add_error_message_to_entity(db.Entity(name="TestEnt"), ent = _add_error_message_to_entity(db.Entity(name="TestEnt"),
code) code)
with raises(TransactionError) as e: with raises(TransactionError) as e:
raise_errors(e) raise_errors(ent)
assert len(e.value.errors) == 1 assert len(e.value.errors) == 1
err = e.value.errors[0] err = e.value.errors[0]
assert isinstance(err, EntityError) assert isinstance(err, EntityError)
...@@ -145,7 +148,7 @@ def test_unqualified_parents_error(): ...@@ -145,7 +148,7 @@ def test_unqualified_parents_error():
assert isinstance(te.errors[0].errors[0], EntityDoesNotExistError) assert isinstance(te.errors[0].errors[0], EntityDoesNotExistError)
assert te.errors[0].errors[0].entity.name == parent.name assert te.errors[0].errors[0].entity.name == parent.name
@pytest.mark.xfail
def test_unqualified_properties_error(): def test_unqualified_properties_error():
"""Code 114; properties do not exist or have wrong data types or """Code 114; properties do not exist or have wrong data types or
values. values.
...@@ -175,7 +178,7 @@ def test_unqualified_properties_error(): ...@@ -175,7 +178,7 @@ def test_unqualified_properties_error():
# #################### Multiple errors #################### # #################### Multiple errors ####################
@pytest.mark.xfail
def test_parent_and_properties_errors(): def test_parent_and_properties_errors():
"""Record with UnqualifiedParentsError and UnqualifiedPropertiesError, """Record with UnqualifiedParentsError and UnqualifiedPropertiesError,
and corresponding parent and properties with their errors as and corresponding parent and properties with their errors as
...@@ -202,7 +205,7 @@ def test_parent_and_properties_errors(): ...@@ -202,7 +205,7 @@ def test_parent_and_properties_errors():
# TODO: Now there should be two direct children; both have to be # TODO: Now there should be two direct children; both have to be
# displayed correctly. # displayed correctly.
@pytest.mark.xfail
def test_container_with_faulty_elements(): def test_container_with_faulty_elements():
"""Code 12; container with valid and invalid entities. All faulty """Code 12; container with valid and invalid entities. All faulty
entities have to be reflected correctly in the errors list of the entities have to be reflected correctly in the errors list of the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment