-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a TODOs sheet containing on REQUIRES_REVIEW resources in XLSX #1524…
… (#1527) Signed-off-by: tdruez <[email protected]>
- Loading branch information
Showing
11 changed files
with
148 additions
and
28 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
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 |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
from django.core.management import call_command | ||
from django.test import TestCase | ||
|
||
import openpyxl | ||
import xlsxwriter | ||
from licensedcode.cache import get_licensing | ||
from lxml import etree | ||
|
@@ -42,10 +43,12 @@ | |
from scanpipe.models import CodebaseResource | ||
from scanpipe.models import Project | ||
from scanpipe.models import ProjectMessage | ||
from scanpipe.pipes import flag | ||
from scanpipe.pipes import output | ||
from scanpipe.tests import FIXTURES_REGEN | ||
from scanpipe.tests import make_dependency | ||
from scanpipe.tests import make_package | ||
from scanpipe.tests import make_resource_file | ||
from scanpipe.tests import mocked_now | ||
from scanpipe.tests import package_data1 | ||
|
||
|
@@ -210,16 +213,30 @@ def test_scanpipe_pipes_outputs_to_xlsx(self): | |
model="Model", | ||
details={}, | ||
) | ||
make_resource_file( | ||
project=project, path="path/file1.ext", status=flag.REQUIRES_REVIEW | ||
) | ||
|
||
output_file = output.to_xlsx(project=project) | ||
self.assertIn(output_file.name, project.output_root) | ||
|
||
# Make sure the output can be generated even if the work_directory was wiped | ||
shutil.rmtree(project.work_directory) | ||
with self.assertNumQueries(8): | ||
with self.assertNumQueries(10): | ||
output_file = output.to_xlsx(project=project) | ||
self.assertIn(output_file.name, project.output_root) | ||
|
||
workbook = openpyxl.load_workbook(output_file, read_only=True, data_only=True) | ||
expected_sheet_names = [ | ||
"PACKAGES", | ||
"DEPENDENCIES", | ||
"RESOURCES", | ||
"RELATIONS", | ||
"MESSAGES", | ||
"TODOS", | ||
] | ||
self.assertEqual(expected_sheet_names, workbook.get_sheet_names()) | ||
|
||
def test_scanpipe_pipes_outputs_vulnerability_as_cyclonedx(self): | ||
component_bom_ref = "pkg:pypi/[email protected]" | ||
data = self.data / "cyclonedx/django-4.0.10-vulnerability.json" | ||
|
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
Oops, something went wrong.