Skip to content

Commit 63309bf

Browse files
committed
Fix failing tests #1524
Signed-off-by: tdruez <tdruez@nexb.com>
1 parent d6bc764 commit 63309bf

File tree

3 files changed

+3
-33
lines changed

3 files changed

+3
-33
lines changed

scanpipe/forms.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,7 @@ def get_queryset(self):
322322
CodebaseRelation.objects.select_related("from_resource", "to_resource")
323323
),
324324
"projectmessage": ProjectMessage.objects.all(),
325-
"todos": (
326-
CodebaseResource.objects.files().status(flag.REQUIRES_REVIEW)
327-
),
325+
"todos": CodebaseResource.objects.files().status(flag.REQUIRES_REVIEW),
328326
}
329327

330328
return querysets.get(self.cleaned_data["model_name"])

scanpipe/pipes/output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ def to_xlsx(project):
493493
_add_xlsx_worksheet(workbook, "LAYERS", layers_data, docker.layer_fields)
494494

495495
todos_queryset = get_queryset(project, "todos")
496-
if todos_queryset.exists():
496+
if todos_queryset:
497497
queryset_to_xlsx_worksheet(
498498
todos_queryset, workbook, exclude_fields, worksheet_name="TODOS"
499499
)

scanpipe/tests/pipes/test_output.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def test_scanpipe_pipes_outputs_to_xlsx(self):
222222

223223
# Make sure the output can be generated even if the work_directory was wiped
224224
shutil.rmtree(project.work_directory)
225-
with self.assertNumQueries(9):
225+
with self.assertNumQueries(10):
226226
output_file = output.to_xlsx(project=project)
227227
self.assertIn(output_file.name, project.output_root)
228228

@@ -497,34 +497,6 @@ def test_scanpipe_pipes_outputs_to_attribution(self):
497497
output_file = output.to_attribution(project=project)
498498
self.assertEqual("EMPTY_TEMPLATE", output_file.read_text())
499499

500-
def test_scanpipe_pipes_outputs_get_todos_data(self):
501-
project = Project.objects.create(name="Analysis")
502-
todos_data = output.get_todos_data(project)
503-
self.assertEqual([], list(todos_data))
504-
505-
make_resource_file(
506-
project=project, path="path/file1.ext", status=flag.REQUIRES_REVIEW
507-
)
508-
make_resource_file(project=project, path="path/file2.ext")
509-
510-
todos_data = output.get_todos_data(project)
511-
expected = [
512-
{
513-
"path": "path/file1.ext",
514-
"status": "requires-review",
515-
"size": None,
516-
"name": "file1.ext",
517-
"extension": ".ext",
518-
"programming_language": "",
519-
"mime_type": "",
520-
"tag": "path",
521-
"detected_license_expression": "",
522-
"compliance_alert": "",
523-
"project__name": "Analysis",
524-
}
525-
]
526-
self.assertEqual(expected, list(todos_data))
527-
528500

529501
class ScanPipeXLSXOutputPipesTest(TestCase):
530502
def test__add_xlsx_worksheet_does_truncates_long_strings_over_max_len(self):

0 commit comments

Comments
 (0)