コード例 #1
0
def test_grouping_nvt_oid_per_type():
    scan_results = gen_report(hosts, oids, with_optional=True)
    data = {"report": {"report": scan_results}}
    report = transform(data)
    results = report.results[0]["results"]
    # so far refs are hardcoded to ten
    assert len(results[0]["nvt_refs_ref"]["CVE"]) == 10
コード例 #2
0
def test_report_generation_per_host(expected):
    amount_scans, scan_results = expected
    data = {"report": {"report": scan_results}}
    report = transform(data)
    assert len(report.results or []) == amount_scans
コード例 #3
0
def test_remove_general_from_equipment_port_list():
    scan_results = gen_report(hosts, oids, port="general/tcp")
    data = {"report": {"report": scan_results}}
    report = transform(data)
    assert report.results[0]["equipment"]["ports"] == []
コード例 #4
0
def test_should_contain_non_general_ports():
    scan_results = gen_report(hosts, oids, port="80/tcp")
    data = {"report": {"report": scan_results}}
    report = transform(data)
    assert report.results[0]["equipment"]["ports"] == {"80/tcp"}
コード例 #5
0
def test_group_by_host(scan_result):
    data = {'report': {'report': scan_result}}
    result = transform(data, group_by=group_by_host)
    assert len(result.results.scans) == 2
コード例 #6
0
def test_group_by_nvt(scan_result):
    data = {'report': scan_result}
    result = transform(data, group_by=group_by_nvt)
    assert len(result.results.scans) == len(oids)
コード例 #7
0
def test_report_generation(expected):
    amount_scans, scan_results = expected
    data = {'report': {'report': scan_results}}
    report = transform(data)
    assert len(report.results or []) == amount_scans