From 58d0fea207884f684b0fe4e7b09b1c5b4b7446b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20M=C3=B6ller?= Date: Tue, 14 Nov 2023 18:02:40 +0100 Subject: [PATCH] test: add schema validation of wrong attribute JSON/XML files --- test/compliance_tool/test_compliance_check_json.py | 8 ++++++++ test/compliance_tool/test_compliance_check_xml.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/test/compliance_tool/test_compliance_check_json.py b/test/compliance_tool/test_compliance_check_json.py index 252abdb64..b6201d108 100644 --- a/test/compliance_tool/test_compliance_check_json.py +++ b/test/compliance_tool/test_compliance_check_json.py @@ -48,6 +48,14 @@ def test_check_schema(self) -> None: self.assertEqual(Status.SUCCESS, manager.steps[1].status) self.assertEqual(Status.SUCCESS, manager.steps[2].status) + manager.steps = [] + file_path_5 = os.path.join(script_dir, 'files/test_demo_full_example_wrong_attribute.json') + compliance_tool.check_schema(file_path_5, manager) + self.assertEqual(3, len(manager.steps)) + self.assertEqual(Status.SUCCESS, manager.steps[0].status) + self.assertEqual(Status.SUCCESS, manager.steps[1].status) + self.assertEqual(Status.SUCCESS, manager.steps[2].status) + def test_check_deserialization(self) -> None: manager = ComplianceToolStateManager() script_dir = os.path.dirname(__file__) diff --git a/test/compliance_tool/test_compliance_check_xml.py b/test/compliance_tool/test_compliance_check_xml.py index 5aac89814..a1658e508 100644 --- a/test/compliance_tool/test_compliance_check_xml.py +++ b/test/compliance_tool/test_compliance_check_xml.py @@ -39,6 +39,14 @@ def test_check_schema(self) -> None: self.assertEqual(Status.SUCCESS, manager.steps[1].status) self.assertEqual(Status.SUCCESS, manager.steps[2].status) + manager.steps = [] + file_path_4 = os.path.join(script_dir, 'files/test_demo_full_example_wrong_attribute.xml') + compliance_tool.check_schema(file_path_4, manager) + self.assertEqual(3, len(manager.steps)) + self.assertEqual(Status.SUCCESS, manager.steps[0].status) + self.assertEqual(Status.SUCCESS, manager.steps[1].status) + self.assertEqual(Status.SUCCESS, manager.steps[2].status) + def test_check_deserialization(self) -> None: manager = ComplianceToolStateManager() script_dir = os.path.dirname(__file__)