Skip to content

Commit

Permalink
test: add schema validation of wrong attribute JSON/XML files
Browse files Browse the repository at this point in the history
  • Loading branch information
jkhsjdhjs authored and s-heppner committed Nov 14, 2023
1 parent 24d4cf3 commit 58d0fea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/compliance_tool/test_compliance_check_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down
8 changes: 8 additions & 0 deletions test/compliance_tool/test_compliance_check_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down

0 comments on commit 58d0fea

Please sign in to comment.