Commit cf9f0549 authored by Ondřej Borýsek's avatar Ondřej Borýsek
Browse files

Test scan2report: Skip description if hosts don't match

parent e1cb02ce
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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
@@ -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}"'
@@ -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