Skip to content

Commit

Permalink
Add tests for searching purl type
Browse files Browse the repository at this point in the history
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
  • Loading branch information
TG1999 committed Jan 4, 2023
1 parent f641063 commit 54df79f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions vulnerabilities/tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ def test_package_view_with_valid_purl_and_incomplete_version(self):
"pkg:nginx/nginx@1.0.15",
]

def test_package_view_with_purl_type(self):
qs = PackageSearch().get_queryset(query="pkg:pypi")
pkgs = list(qs)
pkgs = [p.purl for p in pkgs]
assert pkgs == ["pkg:pypi/foo@1"]

def test_package_view_with_type_as_input(self):
qs = PackageSearch().get_queryset(query="pypi")
pkgs = list(qs)
pkgs = [p.purl for p in pkgs]
assert pkgs == ["pkg:pypi/foo@1"]


class VulnerabilitySearchTestCase(TestCase):
def setUp(self):
Expand Down

0 comments on commit 54df79f

Please sign in to comment.