Passed
Pull Request — master (#6)
by Jan
03:39
created

tests.test_scap_report_parser.test_validation()   A

Complexity

Conditions 2

Size

Total Lines 11
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 10
nop 2
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
1
import pytest
2
3
from oscap_report.scap_results_parser.scap_results_parser import \
4
    SCAPResultsParser
5
6
from .constants import PATH_TO_ARF, PATH_TO_EMPTY_XML_FILE, PATH_TO_XCCDF
7
8
9
@pytest.mark.parametrize("file_path, result", [
10
    (PATH_TO_ARF, True),
11
    (PATH_TO_XCCDF, False),
12
    (PATH_TO_EMPTY_XML_FILE, False),
13
])
14
def test_validation(file_path, result):
15
    xml_data = None
16
    with open(file_path) as xml_report:
17
        xml_data = xml_report.read().encode()
18
    parser = SCAPResultsParser(xml_data)
19
    assert parser.validate(parser.arf_schemas_path) == result
20