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

TST: reactivate xfail test

parent f5038ef2
Branches
Tags
2 merge requests!91Release 0.3,!67MAINT: introduce an identifiable class
Pipeline #30769 failed
......@@ -476,7 +476,6 @@ def test_split_into_inserts_and_updates_with_copy_attr(crawler_mocked_identifiab
crawler.identifiableAdapter.retrieve_identified_record_for_identifiable.assert_called()
@pytest.mark.xfail()
def test_has_missing_object_in_references(crawler):
# Simulate remote server content by using the names to identify records
# There are only two known Records with name A and B
......@@ -488,34 +487,31 @@ def test_has_missing_object_in_references(crawler):
}))
# one reference with id -> check
assert not crawler._has_missing_object_in_references(db.Record(name="C")
.add_parent("RTC").add_property('d', 123))
assert not crawler._has_missing_object_in_references(
Identifiable(name="C", record_type="RTC", properties={'d': 123}))
# one ref with Entity with id -> check
assert not crawler._has_missing_object_in_references(db.Record(name="C")
.add_parent("RTC")
.add_property('d', db.Record(id=123)
.add_parent("C")))
assert not crawler._has_missing_object_in_references(
Identifiable(name="C", record_type="RTC", properties={'d': db.Record(id=123)
.add_parent("C")}))
# one ref with id one with Entity with id (mixed) -> check
assert not crawler._has_missing_object_in_references(db.Record(name="C").add_parent("RTD")
.add_property('d', 123)
.add_property('b', db.Record(id=123)
.add_parent("RTC")))
assert not crawler._has_missing_object_in_references(
Identifiable(name="C", record_type="RTD",
properties={'d': 123, 'b': db.Record(id=123).add_parent("RTC")}))
# entity to be referenced in the following
a = db.Record(name="C").add_parent("C").add_property("d", 12311)
# one ref with id one with Entity without id (but not identifying) -> fail
assert not crawler._has_missing_object_in_references(db.Record(name="C").add_parent("RTC")
.add_property('d', 123)
.add_property('e', a))
assert not crawler._has_missing_object_in_references(
Identifiable(name="C", record_type="RTC", properties={'d': 123, 'e': a}))
# one ref with id one with Entity without id (mixed) -> fail
assert not crawler._has_missing_object_in_references(db.Record(name="D").add_parent("RTD")
.add_property('d', 123)
.add_property('e', a))
assert not crawler._has_missing_object_in_references(
Identifiable(name="D", record_type="RTD", properties={'d': 123, 'e': a}))
crawler.add_to_remote_missing_cache(a)
# one ref with id one with Entity without id but in cache -> check
assert crawler._has_missing_object_in_references(db.Record(name="D").add_parent("RTD")
.add_property('d', 123)
.add_property('e', a))
assert crawler._has_missing_object_in_references(
Identifiable(name="D", record_type="RTD", properties={'d': 123, 'e': a}))
# if this ever fails, the mock up may be removed
crawler.identifiableAdapter.get_registered_identifiable.assert_called()
......@@ -528,7 +524,8 @@ def test_references_entities_without_ids(crawler, ident):
# id and rec with id
assert not crawler._has_reference_value_without_id(db.Record().add_parent("Person")
.add_property('first_name', 123)
.add_property('last_name', db.Record(id=123)))
.add_property('last_name',
db.Record(id=123)))
# id and rec with id and one unneeded prop
assert crawler._has_reference_value_without_id(db.Record().add_parent("Person")
.add_property('first_name', 123)
......@@ -584,6 +581,9 @@ def reset_mocks(mocks):
def change_identifiable_prop(ident):
"""
This function is supposed to change a non identifiing property.
"""
for ent in ident._records:
if len(ent.parents) == 0 or ent.parents[0].name != "Measurement":
continue
......@@ -593,10 +593,14 @@ def change_identifiable_prop(ident):
# change one element; This removes a responsible which is not part of the identifiable
prop.value = "2022-01-04"
return
# If it does not work, this test is not implemented properly
raise RuntimeError("Did not find the property that should be changed.")
def change_non_identifiable_prop(ident):
"""
This function is supposed to change a non identifiing property.
"""
for ent in ident._records:
if len(ent.parents) == 0 or ent.parents[0].name != "Measurement":
continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment