Skip to content

Commit 386b587

Browse files
committed
Add tests for searching purl type
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent cd3d2c2 commit 386b587

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

vulnerabilities/tests/test_view.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,18 @@ def test_package_view_with_valid_purl_and_incomplete_version(self):
123123
"pkg:nginx/nginx@1.0.15",
124124
]
125125

126+
def test_package_view_with_purl_type(self):
127+
qs = PackageSearch().get_queryset(query="pkg:pypi")
128+
pkgs = list(qs)
129+
pkgs = [p.purl for p in pkgs]
130+
assert pkgs == ["pkg:pypi/foo@1"]
131+
132+
def test_package_view_with_type_as_input(self):
133+
qs = PackageSearch().get_queryset(query="pypi")
134+
pkgs = list(qs)
135+
pkgs = [p.purl for p in pkgs]
136+
assert pkgs == ["pkg:pypi/foo@1"]
137+
126138

127139
class VulnerabilitySearchTestCase(TestCase):
128140
def setUp(self):

0 commit comments

Comments
 (0)