From 6939b5dfff2ca6aecbf22ff4a648933a52848ea3 Mon Sep 17 00:00:00 2001 From: MartinWheelerMT Date: Wed, 11 Dec 2024 15:25:05 +0000 Subject: [PATCH] add unit test for equals sign in file name when parsing ebxml --- mhs/common/mhs_common/messages/ebxml_envelope.py | 1 + mhs/common/mhs_common/messages/tests/test_ebxml_envelope.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mhs/common/mhs_common/messages/ebxml_envelope.py b/mhs/common/mhs_common/messages/ebxml_envelope.py index f4ed266a7..773c202a1 100644 --- a/mhs/common/mhs_common/messages/ebxml_envelope.py +++ b/mhs/common/mhs_common/messages/ebxml_envelope.py @@ -227,6 +227,7 @@ def parse_external_attachments(xml_tree: Element) -> Dict[str, str]: variables = descriptionParams = re.findall("(?:\".*?\"|\S)+", description.strip()) filename = None + print(variables) description_variables = dict(pair.split("=") for pair in variables) if "Filename" in description_variables: filename = description_variables["Filename"].replace('\\', '') diff --git a/mhs/common/mhs_common/messages/tests/test_ebxml_envelope.py b/mhs/common/mhs_common/messages/tests/test_ebxml_envelope.py index a702a077a..59de8feb3 100644 --- a/mhs/common/mhs_common/messages/tests/test_ebxml_envelope.py +++ b/mhs/common/mhs_common/messages/tests/test_ebxml_envelope.py @@ -51,6 +51,6 @@ def test_filename_contains_equals_sign(self): ) xml_tree = ElementTree.fromstring(message) - result = ebxml_envelope.EbxmlEnvelope.parse_external_attachments(xml_tree) - values_dict = {} - self.assertEqual(result, values_dict) \ No newline at end of file + external_attachments = ebxml_envelope.EbxmlEnvelope.parse_external_attachments(xml_tree) + print(external_attachments.keys()) + self.assertEqual(external_attachments, {})