-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 1325-webhooks-trigger
- Loading branch information
Showing
8 changed files
with
149 additions
and
45 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
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 |
---|---|---|
|
@@ -237,17 +237,17 @@ def test_scanpipe_pipes_purldb_create_project_name(self): | |
project_name = purldb.create_project_name(download_url, scannable_uri_uuid) | ||
self.assertEqual("httpsregistrynpmjsorgasdf-asdf-101tgz-52b2930d", project_name) | ||
|
||
@mock.patch("scanpipe.pipes.purldb.get_package_by_purl") | ||
def test_scanpipe_pipes_purldb_enrich_package(self, mock_get_package_by_purl): | ||
@mock.patch("scanpipe.pipes.purldb.collect_data_for_purl") | ||
def test_scanpipe_pipes_purldb_enrich_package(self, mock_collect_data): | ||
package1 = make_package(self.project1, package_url="pkg:npm/[email protected]") | ||
|
||
mock_get_package_by_purl.return_value = {} | ||
mock_collect_data.return_value = [] | ||
updated_fields = purldb.enrich_package(package=package1) | ||
self.assertIsNone(updated_fields) | ||
|
||
purldb_entry_file = self.data / "purldb" / "csvtojson-2.0.10.json" | ||
purldb_entry = json.loads(purldb_entry_file.read_text()) | ||
mock_get_package_by_purl.return_value = purldb_entry | ||
mock_collect_data.return_value = [purldb_entry] | ||
updated_fields = purldb.enrich_package(package=package1) | ||
self.assertTrue(updated_fields) | ||
self.assertIn("homepage_url", updated_fields) | ||
|
@@ -258,13 +258,11 @@ def test_scanpipe_pipes_purldb_enrich_package(self, mock_get_package_by_purl): | |
self.assertEqual(purldb_entry.get("sha256"), package1.sha256) | ||
self.assertEqual(purldb_entry.get("copyright"), package1.copyright) | ||
|
||
@mock.patch("scanpipe.pipes.purldb.get_package_by_purl") | ||
def test_scanpipe_pipes_purldb_enrich_discovered_packages( | ||
self, mock_get_package_by_purl | ||
): | ||
@mock.patch("scanpipe.pipes.purldb.collect_data_for_purl") | ||
def test_scanpipe_pipes_purldb_enrich_discovered_packages(self, mock_collect_data): | ||
package1 = make_package(self.project1, package_url="pkg:npm/[email protected]") | ||
|
||
mock_get_package_by_purl.return_value = {} | ||
mock_collect_data.return_value = [] | ||
buffer = io.StringIO() | ||
updated_package_count = purldb.enrich_discovered_packages( | ||
project=self.project1, | ||
|
@@ -276,7 +274,7 @@ def test_scanpipe_pipes_purldb_enrich_discovered_packages( | |
|
||
purldb_entry_file = self.data / "purldb" / "csvtojson-2.0.10.json" | ||
purldb_entry = json.loads(purldb_entry_file.read_text()) | ||
mock_get_package_by_purl.return_value = purldb_entry | ||
mock_collect_data.return_value = [purldb_entry] | ||
buffer = io.StringIO() | ||
updated_package_count = purldb.enrich_discovered_packages( | ||
project=self.project1, | ||
|
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