Loading tests/test_scan2report.py +6 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ from pathlib import Path import os.path from typing import List, Optional, Callable, Any, Tuple from pprint import pprint from loguru import logger import pytest from pytest_steps import test_steps from copy import deepcopy Loading Loading @@ -108,6 +110,9 @@ class TestScan2Report: if current_finding['description'] != correct_finding['description']: save_file(current_finding['description'], output_path_by_filename(filename + '_current_description')) save_file(correct_finding['description'], output_path_by_filename(filename + '_correct_description')) if current_finding['hosts'] != correct_finding['hosts']: logger.warning("Description is different, but it may be because .hosts might be in different order. Skipping for now.") continue if not isinstance(current_finding[single_key], list): assert current_finding[single_key] == correct_finding[single_key], f'Failed on key "{single_key}"' Loading @@ -117,6 +122,7 @@ class TestScan2Report: # assert current_finding == correct_finding except AssertionError: print(f'Failed for {filename}, FID {current_finding["fid"]}') json_dump(current_result[i], output_path_by_filename(filename + '_current')) json_dump(correct_result[i], output_path_by_filename(filename + '_correct')) raise Loading
tests/test_scan2report.py +6 −0 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ from pathlib import Path import os.path from typing import List, Optional, Callable, Any, Tuple from pprint import pprint from loguru import logger import pytest from pytest_steps import test_steps from copy import deepcopy Loading Loading @@ -108,6 +110,9 @@ class TestScan2Report: if current_finding['description'] != correct_finding['description']: save_file(current_finding['description'], output_path_by_filename(filename + '_current_description')) save_file(correct_finding['description'], output_path_by_filename(filename + '_correct_description')) if current_finding['hosts'] != correct_finding['hosts']: logger.warning("Description is different, but it may be because .hosts might be in different order. Skipping for now.") continue if not isinstance(current_finding[single_key], list): assert current_finding[single_key] == correct_finding[single_key], f'Failed on key "{single_key}"' Loading @@ -117,6 +122,7 @@ class TestScan2Report: # assert current_finding == correct_finding except AssertionError: print(f'Failed for {filename}, FID {current_finding["fid"]}') json_dump(current_result[i], output_path_by_filename(filename + '_current')) json_dump(correct_result[i], output_path_by_filename(filename + '_correct')) raise