-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify pipelines to get purls from package_data (#904)
* Modify pipelines to get purls from package_data Signed-off-by: Ayan Sinha Mahapatra <[email protected]> * Only get purls from package data if no packages Signed-off-by: Ayan Sinha Mahapatra <[email protected]> * Add docstrings and tests Signed-off-by: Ayan Sinha Mahapatra <[email protected]> * Only submit unique purls Signed-off-by: Ayan Sinha Mahapatra <[email protected]> * Add docstrings and comments from feedback Signed-off-by: Ayan Sinha Mahapatra <[email protected]> * Update test expectations Updates test expectations which after modifying populate purldb pipeline to only send unique purls. Signed-off-by: Ayan Sinha Mahapatra <[email protected]> * Address review comments Signed-off-by: Ayan Sinha Mahapatra <[email protected]> --------- Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
- Loading branch information
1 parent
b50763a
commit ade2953
Showing
5 changed files
with
103 additions
and
11 deletions.
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
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 |
---|---|---|
|
@@ -397,6 +397,23 @@ def test_scanpipe_pipes_scancode_virtual_codebase(self): | |
self.assertEqual(1, DiscoveredPackage.objects.count()) | ||
self.assertEqual(1, DiscoveredDependency.objects.count()) | ||
|
||
def test_scanpipe_pipes_scancode_get_packages_with_purl_from_resources(self): | ||
project = Project.objects.create(name="Analysis") | ||
filename = "package_assembly_codebase.json" | ||
project_scan_location = self.data_location / "scancode" / filename | ||
input.load_inventory_from_toolkit_scan(project, project_scan_location) | ||
|
||
project.discoveredpackages.all().delete() | ||
self.assertEqual(0, project.discoveredpackages.count()) | ||
|
||
packages = list(scancode.get_packages_with_purl_from_resources(project)) | ||
|
||
package_purl_exists = [True for package in packages if package.purl] | ||
package_purls = [package.purl for package in packages] | ||
self.assertTrue(package_purl_exists) | ||
self.assertEqual(len(package_purl_exists), 1) | ||
self.assertTrue("pkg:npm/[email protected]" in package_purls) | ||
|
||
def test_scanpipe_pipes_scancode_run_scancode(self): | ||
project = Project.objects.create(name="name with space") | ||
output = scancode.run_scan( | ||
|
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