-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support incomplete versions for a valid purl in search
Signed-off-by: Tushar Goel <[email protected]>
- Loading branch information
Showing
3 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ def setUp(self): | |
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:pypi/foo@1", | ||
] | ||
self.packages = packages | ||
for package in packages: | ||
|
@@ -63,6 +64,65 @@ def test_package_view_with_purl_fragment(self): | |
self.assertEqual(len(pkgs), 1) | ||
self.assertEqual(pkgs[0].purl, "pkg:nginx/[email protected]") | ||
|
||
def test_package_view_with_purl_fragment(self): | ||
qs = PackageSearch().get_queryset(query="nginx/nginx") | ||
pkgs = list(qs) | ||
pkgs = [p.purl for p in pkgs] | ||
assert pkgs == [ | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
] | ||
|
||
def test_package_view_with_valid_purl_without_version(self): | ||
qs = PackageSearch().get_queryset(query="pkg:nginx/nginx") | ||
pkgs = list(qs) | ||
pkgs = [p.purl for p in pkgs] | ||
assert pkgs == [ | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
] | ||
|
||
def test_package_view_with_valid_purl_and_incomplete_version(self): | ||
qs = PackageSearch().get_queryset(query="pkg:nginx/nginx@1") | ||
pkgs = list(qs) | ||
pkgs = [p.purl for p in pkgs] | ||
assert pkgs == [ | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
"pkg:nginx/[email protected]", | ||
] | ||
|
||
|
||
class VulnerabilitySearchTestCase(TestCase): | ||
def setUp(self): | ||
|