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

tests.test_scap_report_parser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_validation() 0 11 2
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