Skip to content
Snippets Groups Projects
Commit 75f80222 authored by Siarhei Khaletski (EPAM)'s avatar Siarhei Khaletski (EPAM) :triangular_flag_on_post:
Browse files

Merge branch 'bugfix/GONRG-2293_Fix_missing_colon_in_parent_srn_with_surrogate-key' into 'master'

GONRG-2293: Fix Missing colon in parent srn with surrogate-key

See merge request !49
parents a3f8570a 63528eeb
No related branches found
No related tags found
1 merge request!49GONRG-2293: Fix Missing colon in parent srn with surrogate-key
Pipeline #38524 passed
......@@ -98,7 +98,7 @@ class EntityNode(object):
for parent in self.parents:
if parent.system_srn:
# ':' at the end is for showing that it is reference if parent srn was surrogate-key.
if "surrogate-key" in parent.system_srn:
if "surrogate-key" in parent.srn:
content = content.replace(parent.srn, f"{parent.system_srn}:")
else:
content = content.replace(parent.srn, f"{parent.system_srn}")
......
......@@ -204,7 +204,7 @@ class TestManifestAnalyzer(object):
assert "surrogate-key:wpc-1" in (e.srn for e in manifest_analyzer.unprocessed_entities)
@pytest.mark.parametrize(
"manifest,expected_replaced_srns",
"manifest,system_srn,expected_replaced_srns",
[
pytest.param(
[
......@@ -217,7 +217,8 @@ class TestManifestAnalyzer(object):
}
],
"system_srn: surrogate-key:wpc2:",
"test:work-product--WorkProduct:7b37ff0e13ac40a0ac35b7e5ca60e5a7",
"test:work-product--WorkProduct:7b37ff0e13ac40a0ac35b7e5ca60e5a7:",
id="Surrogate key"
),
pytest.param(
......@@ -231,12 +232,13 @@ class TestManifestAnalyzer(object):
}
],
"osdu:reference-data--ResourceSecurityClassification:RESTRICTED:test",
"osdu:reference-data--ResourceSecurityClassification:RESTRICTED:test:",
id="Real Ids"
)
]
)
def test_update_parent_srn_with_system_srn(self, manifest, expected_replaced_srns):
def test_update_parent_srn_with_system_srn(self, manifest, system_srn, expected_replaced_srns):
data = [ManifestEntity(entity=e, schema="") for e in manifest]
token_refresher = AirflowTokenRefresher()
manifest_analyzer = ManifestAnalyzer(
......@@ -246,6 +248,6 @@ class TestManifestAnalyzer(object):
for entity in manifest_analyzer.entity_queue():
entity.replace_parents_surrogate_srns()
entity.system_srn = self.process_entity(entity)
entity.system_srn = system_srn
if entity.content.get("ref"):
assert entity.content["ref"] == expected_replaced_srns
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment