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

tests pass

parent 2c57c5e6
No related branches found
No related tags found
2 merge requests!91Release 0.3,!67MAINT: introduce an identifiable class
Pipeline #30449 passed
......@@ -197,7 +197,8 @@ class IdentifiableAdapter(metaclass=ABCMeta):
"Multi properties used in identifiables could cause unpredictable results and are"
" not allowed. You might want to consider a Property with a list as value.")
return Identifiable(record_type=registered_identifiable.parents[0].name,
return Identifiable(record_type=(registered_identifiable.parents[0].name
if registered_identifiable else None),
name=record.name,
properties=identifiable_props,
path=record.path
......
This diff is collapsed.
......@@ -582,24 +582,30 @@ def reset_mocks(mocks):
def change_identifiable_prop(ident):
# the checks in here are only to make sure we change the record as we intend to
meas = ident._records[-2]
assert meas.parents[0].name == "Measurement"
resps = meas.properties[0]
assert resps.name == "date"
# change one element; This changes the date which is part of the identifiable
resps.value = "2022-01-04"
for ent in ident._records:
if len(ent.parents) == 0 or ent.parents[0].name != "Measurement":
continue
for prop in ent.properties:
if prop.name != "date":
continue
# change one element; This removes a responsible which is not part of the identifiable
prop.value = "2022-01-04"
return
raise RuntimeError("Did not find the property that should be changed.")
def change_non_identifiable_prop(ident):
# the checks in here are only to make sure we change the record as we intend to
meas = ident._records[-1]
assert meas.parents[0].name == "Measurement"
resps = meas.properties[-1]
assert resps.name == "responsible"
assert len(resps.value) == 2
for ent in ident._records:
if len(ent.parents) == 0 or ent.parents[0].name != "Measurement":
continue
for prop in ent.properties:
if prop.name != "responsible" or len(prop.value) < 2:
continue
# change one element; This removes a responsible which is not part of the identifiable
del resps.value[-1]
del prop.value[-1]
return
raise RuntimeError("Did not find the property that should be changed.")
@patch("caoscrawler.crawl.Crawler._get_entity_by_id",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment