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

Merge branch 'dev' into f-retrieve-identified

parents 4563c3b5 0f1182c7
Branches
Tags
4 merge requests!123REL: Release v0.6.0,!114F retrieve identified,!113F refactor test tool,!110F id only
Pipeline #35273 failed
...@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### ### Fixed ###
- usage of ID when looking for identified records - usage of ID when looking for identified records
- Query generation when there are only backrefs or backrefs and a name
### Security ### ### Security ###
......
...@@ -118,6 +118,10 @@ class IdentifiableAdapter(metaclass=ABCMeta): ...@@ -118,6 +118,10 @@ class IdentifiableAdapter(metaclass=ABCMeta):
query_string += " AND " query_string += " AND "
query_string += IdentifiableAdapter.create_property_query(ident) query_string += IdentifiableAdapter.create_property_query(ident)
if query_string.endswith(" AND WITH "):
query_string = query_string[:-len(" AND WITH ")]
if query_string.endswith(" AND "):
query_string = query_string[:-len(" AND ")]
return query_string return query_string
@staticmethod @staticmethod
......
...@@ -76,6 +76,16 @@ def test_create_query_for_identifiable(): ...@@ -76,6 +76,16 @@ def test_create_query_for_identifiable():
Identifiable(record_type="Person", backrefs=[], properties={'last_name': "B'Or"})) Identifiable(record_type="Person", backrefs=[], properties={'last_name': "B'Or"}))
assert query == ("FIND RECORD Person WITH 'last_name'='B\\'Or' ") assert query == ("FIND RECORD Person WITH 'last_name'='B\\'Or' ")
# With only backref
query = IdentifiableAdapter.create_query_for_identifiable(
Identifiable(backrefs=[160], properties={}))
assert query == ("FIND RECORD WHICH IS REFERENCED BY 160")
# With only backref and name
query = IdentifiableAdapter.create_query_for_identifiable(
Identifiable(backrefs=[160], name='lo', properties={}))
assert query == ("FIND RECORD WHICH IS REFERENCED BY 160 AND WITH name='lo'")
def test_load_from_yaml_file(): def test_load_from_yaml_file():
ident = CaosDBIdentifiableAdapter() ident = CaosDBIdentifiableAdapter()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment