Skip to content

Commit 4141c9b

Browse files
authored
Merge pull request #2343 from ziadhany/fix-rename-patches
Rename introduced_in_patch/fixed_in_patch to introduced_in_patches/fixed_in_patches
2 parents c6aff9c + 819acd0 commit 4141c9b

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

vulnerabilities/api_v3.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,11 +761,11 @@ def get_affected_advisories_bulk(packages, max_advisories, base_url, reachabilit
761761
"exploitability": exploitability,
762762
"risk_score": risk_score,
763763
"fixed_by_packages": fixed_by_packages,
764-
"introduced_in_patch": introduced_patches_by_set.get(
764+
"introduced_in_patches": introduced_patches_by_set.get(
765765
adv.id,
766766
[],
767767
),
768-
"fixed_in_patch": fixed_patches_by_set.get(
768+
"fixed_in_patches": fixed_patches_by_set.get(
769769
adv.id,
770770
[],
771771
),
@@ -864,8 +864,8 @@ def get_affected_advisories_bulk(packages, max_advisories, base_url, reachabilit
864864
"exploitability": advisory.exploitability,
865865
"risk_score": advisory.risk_score,
866866
"fixed_by_packages": fixed_by_packages,
867-
"introduced_in_patch": introduced_patches_by_set.get(advisory_id, []),
868-
"fixed_in_patch": introduced_patches_by_set.get(advisory_id, []),
867+
"introduced_in_patches": introduced_patches_by_set.get(advisory_id, []),
868+
"fixed_in_patches": introduced_patches_by_set.get(advisory_id, []),
869869
"ssvc_trees": [
870870
{
871871
"vector": ssvc.vector,

vulnerabilities/tests/test_api_v3.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -330,14 +330,14 @@ def test_packages_commit_patch(self):
330330
advisory_data = vulns[0]
331331

332332
assert advisory_data["advisory_id"] == "AVID-123"
333-
assert advisory_data["introduced_in_patch"] == [
333+
assert advisory_data["introduced_in_patches"] == [
334334
{
335335
"commit_hash": "06580c7f99c6fde7bcf18e30bdcc61f081430957",
336336
"vcs_url": "https://github.com/aboutcode-org/sample",
337337
}
338338
]
339339

340-
assert advisory_data["fixed_in_patch"] == [
340+
assert advisory_data["fixed_in_patches"] == [
341341
{
342342
"commit_hash": "98e516011d6e096e25247b82fc5f196bbeecff10",
343343
"vcs_url": "https://github.com/aboutcode-org/sample",
@@ -450,7 +450,7 @@ def test_packages_commit_patch(self):
450450
assert {
451451
"commit_hash": "06580c7f99c6fde7bcf18e30bdcc61f081430957",
452452
"vcs_url": "https://github.com/aboutcode-org/sample",
453-
} in advisory_data["introduced_in_patch"]
453+
} in advisory_data["introduced_in_patches"]
454454

455455
def test_advisory_set_member_patches_aggregation(self):
456456
url = reverse("package-v3-list")
@@ -472,10 +472,12 @@ def test_advisory_set_member_patches_aggregation(self):
472472
advisory_data = vulns[0]
473473
assert advisory_data["advisory_id"] == "AVID-123"
474474

475-
introduced_hashes = [patch["commit_hash"] for patch in advisory_data["introduced_in_patch"]]
475+
introduced_hashes = [
476+
patch["commit_hash"] for patch in advisory_data["introduced_in_patches"]
477+
]
476478
assert "06580c7f99c6fde7bcf18e30bdcc61f081430957" in introduced_hashes
477479
assert "98e516011d6e096e25247b82fc5f196bbeecff10" in introduced_hashes
478480

479-
fixed_hashes = [patch["commit_hash"] for patch in advisory_data["fixed_in_patch"]]
481+
fixed_hashes = [patch["commit_hash"] for patch in advisory_data["fixed_in_patches"]]
480482
assert "98e516011d6e096e25247b82fc5f196bbeecff10" in fixed_hashes
481483
assert "2fc5f196bbeecff1098e516011d6e096e25247b8" in fixed_hashes

0 commit comments

Comments
 (0)