Skip to content
Snippets Groups Projects
Commit d6af005e authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

up

parent 341cbb01
No related branches found
No related tags found
2 merge requests!178FIX: #96 Better error output for crawl.py script.,!167Sync Graph
Pipeline #51351 passed with warnings
......@@ -21,16 +21,26 @@
#
class ForbiddenTransaction(Exception):
"""Thrown if an transactions is needed that is not allowed.
For example an update of an entity if the security level is INSERT
"""
pass
class MissingReferencingEntityError(Exception):
"""Thrown if the identifiable requires that some entity references the given entity but there
is no such reference """
def __init__(self, *args, rts=None, **kwargs):
self.rts = rts
super().__init__(self, *args, **kwargs)
class ImpossibleMergeError(Exception):
"""Thrown if due to identifying information, two SyncNodes or two Properties of SyncNodes
should be merged, but there is conflicting information that prevents this.
"""
def __init__(self, *args, pname, values, **kwargs):
self.pname = pname
self.values = values
......@@ -38,4 +48,7 @@ class ImpossibleMergeError(Exception):
class MissingIdentifyingProperty(Exception):
"""Thrown if a SyncNode does not have the properties required by the corresponding registered
identifiable
"""
pass
......@@ -37,8 +37,7 @@ from itertools import product
@pytest.fixture
def simple_adapter():
# We use the reference as identifying reference in both directions. Thus the map is the same
# for all three categories: references, id_references and id_referenced_by
# different RTs with different registered identifiables to allow to test various behavior
ident_adapter = CaosDBIdentifiableAdapter()
ident_adapter.register_identifiable(
"RT1",
......@@ -166,9 +165,12 @@ def test_SyncGraph_init():
for el in st.nodes:
if el.identifiable is not None:
assert st._identifiable_look_up[el.identifiable.get_representation()] is el
# node without ID but with identifiable was merged with other node with ID
assert len([el for el in st.nodes if len(el.properties) > 0
and el.properties[0].value == "MERGEME"]) == 1
# The node, which has no ID but has an identifiable, was merged with another node with ID (due
# to the shared identifiable)
new_one = [el for el in st.nodes if len(el.properties) > 0
and el.properties[0].value == "MERGEME"]
assert len(new_one) == 1
assert new_one[0].id == 104
# every node that does not rely on something unchecked has an identifiable or an ID
for el in st.nodes:
if not st._identity_relies_on_unchecked_entity(el):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment