Skip to content

Commit c386c42

Browse files
committed
Add num query tests for codefix viewset
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 4f51b4a commit c386c42

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ Release notes
44
Version v37.0.0
55
---------------------
66

7-
- This is a major version, this version introduces Advisory level details.
7+
- This is a major version, this version introduces Advisory level details
8+
https://github.com/aboutcode-org/vulnerablecode/issues/1796
9+
https://github.com/aboutcode-org/vulnerablecode/issues/1393
810
- We have added new models AdvisoryV2, AdvisoryAlias, AdvisoryReference, AdvisorySeverity, AdvisoryWeakness, PackageV2 and CodeFixV2.
911
- We are using ``avid`` as an internal advisory ID for uniquely identifying advisories.
1012
- We have a new route ``/v2`` which only support package search which has information on packages that are reported to be affected or fixing by advisories.
1113
- This version introduces ``/api/v2/advisories-packages`` which has information on packages that are reported to be affected or fixing by advisories.
14+
- Pipeline Dashboard improvements #1920.
15+
- Throttle API requests based on user permissions #1909.
1216

1317
Version v36.1.3
1418
---------------------

vulnerabilities/tests/test_api_v2.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ def setUp(self):
859859

860860
def test_list_with_purl_filter(self):
861861
url = reverse("advisories-package-v2-list")
862-
with self.assertNumQueries(16):
862+
with self.assertNumQueries(18):
863863
response = self.client.get(url, {"purl": "pkg:pypi/sample@1.0.0"})
864864
assert response.status_code == 200
865865
assert "packages" in response.data["results"]
@@ -868,7 +868,7 @@ def test_list_with_purl_filter(self):
868868

869869
def test_bulk_lookup(self):
870870
url = reverse("advisories-package-v2-bulk-lookup")
871-
with self.assertNumQueries(11):
871+
with self.assertNumQueries(13):
872872
response = self.client.post(url, {"purls": ["pkg:pypi/sample@1.0.0"]}, format="json")
873873
assert response.status_code == 200
874874
assert "packages" in response.data
@@ -878,7 +878,7 @@ def test_bulk_lookup(self):
878878
def test_bulk_search_plain(self):
879879
url = reverse("advisories-package-v2-bulk-search")
880880
payload = {"purls": ["pkg:pypi/sample@1.0.0"], "plain_purl": True, "purl_only": False}
881-
with self.assertNumQueries(11):
881+
with self.assertNumQueries(13):
882882
response = self.client.post(url, payload, format="json")
883883
assert response.status_code == 200
884884
assert "packages" in response.data
@@ -887,21 +887,21 @@ def test_bulk_search_plain(self):
887887
def test_bulk_search_purl_only(self):
888888
url = reverse("advisories-package-v2-bulk-search")
889889
payload = {"purls": ["pkg:pypi/sample@1.0.0"], "plain_purl": False, "purl_only": True}
890-
with self.assertNumQueries(11):
890+
with self.assertNumQueries(13):
891891
response = self.client.post(url, payload, format="json")
892892
assert response.status_code == 200
893893
assert "pkg:pypi/sample@1.0.0" in response.data
894894

895895
def test_lookup_single_package(self):
896896
url = reverse("advisories-package-v2-lookup")
897-
with self.assertNumQueries(9):
897+
with self.assertNumQueries(11):
898898
response = self.client.post(url, {"purl": "pkg:pypi/sample@1.0.0"}, format="json")
899899
assert response.status_code == 200
900900
assert any(pkg["purl"] == "pkg:pypi/sample@1.0.0" for pkg in response.data)
901901

902902
def test_get_all_vulnerable_purls(self):
903903
url = reverse("advisories-package-v2-all")
904-
with self.assertNumQueries(4):
904+
with self.assertNumQueries(6):
905905
response = self.client.get(url)
906906
assert response.status_code == 200
907907
assert "pkg:pypi/sample@1.0.0" in response.data

0 commit comments

Comments
 (0)