diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py index 13c6a7be4c712f6768f76f953ec303a5fe08df19..a117aeb2c2eb8614b475badc0cd960504e505a6e 100644 --- a/src/caoscrawler/crawl.py +++ b/src/caoscrawler/crawl.py @@ -481,7 +481,7 @@ class Crawler(object): return self._synchronize(self.target_data, commit_changes, unique_names=unique_names) - def references_entity_without_id(self, identifiable: db.Record): + def has_reference_value_without_id(self, identifiable: db.Record): """ Returns True if there is at least one property in record which: a) is a reference property AND @@ -726,7 +726,7 @@ class Crawler(object): resolved_references = True # can we check whether the record(identifiable) exists on the remote server? - elif not self.references_entity_without_id( + elif not self.has_reference_value_without_id( self.identifiableAdapter.get_identifiable(record)): # TODO: remove deepcopy? identified_record = ( diff --git a/unittests/test_tool.py b/unittests/test_tool.py index b77d2a905b27e38d5aaba380734d4c9aa2a954cf..7eba03fed70f531849e1b70d3602c01a5ea3f75a 100755 --- a/unittests/test_tool.py +++ b/unittests/test_tool.py @@ -392,8 +392,8 @@ def test_split_into_inserts_and_updates_single(crawler_mocked_identifiable_retri assert crawler.get_from_any_cache(entlist[0]) is None assert crawler.get_from_any_cache(entlist[1]) is None - assert not crawler.references_entity_without_id(entlist[0]) - assert not crawler.references_entity_without_id(entlist[1]) + assert not crawler.has_reference_value_without_id(entlist[0]) + assert not crawler.has_reference_value_without_id(entlist[1]) assert crawler.identifiableAdapter.retrieve_identified_record_for_record( entlist[0]).id == 1111 assert crawler.identifiableAdapter.retrieve_identified_record_for_record( @@ -542,23 +542,23 @@ def test_no_uncached_entity_object_in_references(crawler): def test_references_entities_without_ids(crawler, ident): - assert not crawler.references_entity_without_id(db.Record().add_parent("Person") - .add_property('last_name', 123) - .add_property('first_name', 123)) + assert not crawler.has_reference_value_without_id(db.Record().add_parent("Person") + .add_property('last_name', 123) + .add_property('first_name', 123)) # id and rec with id - assert not crawler.references_entity_without_id(db.Record().add_parent("Person") - .add_property('first_name', 123) - .add_property('last_name', db.Record(id=123))) + 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))) # id and rec with id and one unneeded prop - assert crawler.references_entity_without_id(db.Record().add_parent("Person") - .add_property('first_name', 123) - .add_property('stuff', db.Record()) - .add_property('last_name', db.Record(id=123))) + assert crawler.has_reference_value_without_id(db.Record().add_parent("Person") + .add_property('first_name', 123) + .add_property('stuff', db.Record()) + .add_property('last_name', db.Record(id=123))) # one identifying prop is missing - assert crawler.references_entity_without_id(db.Record().add_parent("Person") - .add_property('first_name', 123) - .add_property('last_name', db.Record())) + assert crawler.has_reference_value_without_id(db.Record().add_parent("Person") + .add_property('first_name', 123) + .add_property('last_name', db.Record())) def test_replace_entities_with_ids(crawler):