Skip to content

Commit

Permalink
Fix failing unit tests #138
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Aug 2, 2024
1 parent dc4ca0a commit 692cfef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
10 changes: 5 additions & 5 deletions component_catalog/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,27 +716,27 @@ def test_component_catalog_list_view_filters_breadcrumbs(self):

expected = f"""
<div class="my-1">
<a href="{href1}" class="text-decoration-none">
<a href="{href1}" class="text-decoration-none me-1">
<span class="badge text-bg-secondary rounded-pill">
Type: "not_a_valid_entry" <i class="fas fa-times-circle"></i>
</span>
</a>
<a href="{href2}" class="text-decoration-none">
<a href="{href2}" class="text-decoration-none me-1">
<span class="badge text-bg-secondary rounded-pill">
License: "license1" <i class="fas fa-times-circle"></i>
</span>
</a>
<a href="{href3}" class="text-decoration-none">
<a href="{href3}" class="text-decoration-none me-1">
<span class="badge text-bg-secondary rounded-pill">
License: "license2" <i class="fas fa-times-circle"></i>
</span>
</a>
<a href="{href4}" class="text-decoration-none">
<a href="{href4}" class="text-decoration-none me-1">
<span class="badge text-bg-secondary rounded-pill">
Search: "a" <i class="fas fa-times-circle"></i>
</span>
</a>
<a href="{href5}" class="text-decoration-none">
<a href="{href5}" class="text-decoration-none me-1">
<span class="badge text-bg-secondary rounded-pill">
Sort: "name" <i class="fas fa-times-circle"></i>
</span>
Expand Down
3 changes: 1 addition & 2 deletions dje/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,7 @@ def pull_project_data_from_scancodeio(scancodeproject_uuid):

for object_type, values in existing.items():
msg = (
f"- {len(values)} {object_type}{pluralize(values)} were already "
f"available in the Dataspace."
f"- {len(values)} {object_type}{pluralize(values)} already available in the Dataspace."
)
scancode_project.append_to_log(msg)

Expand Down
10 changes: 7 additions & 3 deletions product_portfolio/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2950,14 +2950,18 @@ def test_pull_project_data_from_scancodeio_task(self, mock_import_data):
scancode_project.status = ScanCodeProject.Status.SUBMITTED
scancode_project.save()
mock_import_data.side_effect = None
mock_import_data.return_value = (["package1"], ["package2"], ["error1"])
mock_import_data.return_value = (
{"package": ["package1"]},
{"package": ["package2"]},
{"package": ["error1"]},
)
pull_project_data_from_scancodeio(scancodeproject_uuid=scancode_project.uuid)
scancode_project.refresh_from_db()
self.assertEqual(ScanCodeProject.Status.SUCCESS, scancode_project.status)
expected = [
"- Imported 1 package.",
"- 1 package(s) was/were already available in the Dataspace.",
"- 1 errors occurred during import.",
"- 1 package already available in the Dataspace.",
"- 1 package error occurred during import.",
]
self.assertEqual(expected, scancode_project.import_log)

Expand Down

0 comments on commit 692cfef

Please sign in to comment.