Skip to content

Commit d132e95

Browse files
committed
Add a test for epss
Signed-off-by: ziad hany <[email protected]>
1 parent 582cd32 commit d132e95

File tree

3 files changed

+738
-0
lines changed

3 files changed

+738
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Copyright (c) nexB Inc. and others. All rights reserved.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/aboutcode-org/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
8+
#
9+
10+
from pathlib import Path
11+
12+
import pytest
13+
14+
from vulnerabilities.pipelines.v2_importers.epss_importer_v2 import EPSSImporterPipeline
15+
from vulnerabilities.tests import util_tests
16+
17+
TEST_DATA = Path(__file__).parent.parent.parent / "test_data" / "epss"
18+
19+
TEST_CVE_FILES = (TEST_DATA / "epss_scores-2025-x-x.csv",)
20+
21+
22+
@pytest.mark.django_db
23+
@pytest.mark.parametrize("csv_file", TEST_CVE_FILES)
24+
def test_epss_advisories_per_file(csv_file):
25+
pipeline = EPSSImporterPipeline()
26+
27+
with open(csv_file, "r") as f:
28+
pipeline.lines = f.readlines()
29+
30+
result = [adv.to_dict() for adv in pipeline.collect_advisories()]
31+
expected_file = Path(TEST_DATA / "epss-expected.json")
32+
util_tests.check_results_against_json(result, expected_file)

0 commit comments

Comments
 (0)