Commit 63528eeb authored by Yan Sushchynski (EPAM)'s avatar Yan Sushchynski (EPAM)
Browse files

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

parent a38a7d4c
Pipeline #37373 passed with stages
in 8 minutes and 17 seconds
......@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment