Skip to content

Commit 160ac87

Browse files
committed
fix the test
Signed-off-by: Ziad <[email protected]>
1 parent 9ac6fa2 commit 160ac87

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

vulnerabilities/importers/osv.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ def parse_advisory_data(raw_data: dict, supported_ecosystem) -> Optional[Advisor
5757
for affected_pkg in raw_data.get("affected") or []:
5858
purl = get_affected_purl(affected_pkg, raw_id)
5959
if purl.type != supported_ecosystem:
60-
logger.error(f"un supported ecosystem package found in the advisories: {purl} - from: {raw_id !r}")
60+
logger.error(
61+
f"un supported ecosystem package found in the advisories: {purl} - from: {raw_id !r}"
62+
)
6163
continue
6264

63-
affected_version_range = get_affected_version_range(affected_pkg, raw_id, supported_ecosystem)
65+
affected_version_range = get_affected_version_range(
66+
affected_pkg, raw_id, supported_ecosystem
67+
)
6468
for fixed_range in affected_pkg.get("ranges", []):
6569
fixed_version = get_fixed_version(fixed_range, raw_id)
6670

vulnerabilities/importers/pypa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class PyPaImporter(Importer):
2727

2828
def advisory_data(self) -> Iterable[AdvisoryData]:
2929
for file in fork_and_get_files(self.url):
30-
yield parse_advisory_data(file, supported_ecosystem='pypi')
30+
yield parse_advisory_data(file, supported_ecosystem="pypi")
3131

3232

3333
class ForkError(Exception):

vulnerabilities/importers/pysec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ def advisory_data(self) -> Iterable[AdvisoryData]:
4141
else:
4242
with zip_file.open(file_name) as f:
4343
vul_info = json.load(f)
44-
yield parse_advisory_data(vul_info, supported_ecosystem='pypi')
44+
yield parse_advisory_data(vul_info, supported_ecosystem="pypi")

vulnerabilities/tests/test_osv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def test_get_affected_version_range(self):
223223
"1.6.2",
224224
]
225225
assert get_affected_version_range(
226-
{"versions": aff_version_range}, "GHSA-j3f7-7rmc-6wqj"
226+
{"versions": aff_version_range}, "GHSA-j3f7-7rmc-6wqj", "pypi"
227227
) == (
228228
PypiVersionRange(
229229
constraints=[

vulnerabilities/tests/test_pypa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ def test_to_advisories_with_summary(self):
2323
with open(os.path.join(TEST_DATA, "pypa_test.yaml")) as f:
2424
mock_response = saneyaml.load(f)
2525
expected_file = os.path.join(TEST_DATA, f"pypa-expected.json")
26-
imported_data = parse_advisory_data(mock_response)
26+
imported_data = parse_advisory_data(mock_response, "pypi")
2727
result = imported_data.to_dict()
2828
util_tests.check_results_against_json(result, expected_file)

vulnerabilities/tests/test_pysec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ def test_to_advisories_with_summary(self):
2222
with open(os.path.join(TEST_DATA, "pysec_test_1.json")) as f:
2323
mock_response = json.load(f)
2424
expected_file = os.path.join(TEST_DATA, f"pysec-expected-1.json")
25-
imported_data = parse_advisory_data(mock_response)
25+
imported_data = parse_advisory_data(mock_response, "pypi")
2626
result = imported_data.to_dict()
2727
util_tests.check_results_against_json(result, expected_file)
2828

2929
def test_to_advisories_without_summary(self):
3030
with open(os.path.join(TEST_DATA, "pysec_test_2.json")) as f:
3131
mock_response = json.load(f)
3232
expected_file = os.path.join(TEST_DATA, f"pysec-expected-2.json")
33-
imported_data = parse_advisory_data(mock_response)
33+
imported_data = parse_advisory_data(mock_response, "pypi")
3434
result = imported_data.to_dict()
3535
util_tests.check_results_against_json(result, expected_file)

0 commit comments

Comments
 (0)