From f832a84e685935b157ffd5435eecf5a010397249 Mon Sep 17 00:00:00 2001 From: romanodanilo Date: Fri, 19 Jul 2024 12:38:54 +0200 Subject: [PATCH] Add test cases for check 6 Signed-off-by: romanodanilo --- .../data/Core_Chk006/Core_Chk006_negative.otx | 2 +- tests/test_core_checks.py | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/tests/data/Core_Chk006/Core_Chk006_negative.otx b/tests/data/Core_Chk006/Core_Chk006_negative.otx index c6c12ba..c0bf2ab 100644 --- a/tests/data/Core_Chk006/Core_Chk006_negative.otx +++ b/tests/data/Core_Chk006/Core_Chk006_negative.otx @@ -1,5 +1,5 @@ - None: + base_path = "tests/data/Core_Chk006" + target_file_name = f"Core_Chk006_positive.otx" + target_file_path = os.path.join(base_path, target_file_name) + + test_utils.create_test_config(target_file_path) + + test_utils.launch_main(monkeypatch) + + result = Result() + result.load_from_file(test_utils.REPORT_FILE_PATH) + + core_issues = result.get_issues_by_rule_uid( + "asam.net:otx:1.0.0:core.chk_006.match_of_imported_document_data_model_version" + ) + assert len(core_issues) == 0 + test_utils.cleanup_files() + + +def test_chk006_negative( + monkeypatch, +) -> None: + base_path = "tests/data/Core_Chk006" + target_file_name = f"Core_Chk006_negative.otx" + target_file_path = os.path.join(base_path, target_file_name) + + test_utils.create_test_config(target_file_path) + + test_utils.launch_main(monkeypatch) + + result = Result() + result.load_from_file(test_utils.REPORT_FILE_PATH) + + core_issues = result.get_issues_by_rule_uid( + "asam.net:otx:1.0.0:core.chk_006.match_of_imported_document_data_model_version" + ) + assert len(core_issues) == 1 + assert core_issues[0].level == IssueSeverity.ERROR + assert "1.0.0" in core_issues[0].locations[0].description + + test_utils.cleanup_files() + + def test_chk007_positive( monkeypatch, ) -> None: