Skip to content

Commit 83a4a3b

Browse files
committed
Add unit tests and CHANGELOG entry #241
Signed-off-by: tdruez <[email protected]>
1 parent 5a1f118 commit 83a4a3b

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

CHANGELOG.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,17 @@ Release notes
109109
Owner not found in the Dataspace are now automatically created.
110110
https://github.com/aboutcode-org/dejacode/issues/239
111111

112+
- Updated the label of the following Product actions.
113+
The labels were updated everywhere in the UI (page title, documentation,
114+
import log, etc...) for consistency:
115+
- Import data from Scan -> Import ScanCode scan results
116+
- Load Packages from SBOMs -> Import SBOM
117+
- Import Packages from manifests -> Import Package manifests
118+
- Pull ScanCode.io Project data -> Import ScanCode.io project
119+
Improve the rendering and layout of the Import related forms for consistency,
120+
simplicity, and readability.
121+
https://github.com/aboutcode-org/dejacode/issues/241
122+
112123
### Version 5.2.1
113124

114125
- Fix the models documentation navigation.

product_portfolio/tests/test_importers.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from product_portfolio.models import ProductItemPurpose
3838
from product_portfolio.models import ProductPackage
3939
from product_portfolio.models import ProductRelationStatus
40+
from product_portfolio.models import ScanCodeProject
4041

4142

4243
class ProductRelationImporterTestCase(TestCase):
@@ -751,12 +752,29 @@ def test_product_portfolio_product_import_from_scan_proper(self):
751752
}
752753
self.assertDictEqual(expected_details, resource.additional_details)
753754

755+
scancode_project = importer.scancode_project
756+
self.assertEqual(self.product1, scancode_project.product)
757+
self.assertEqual(self.dataspace, scancode_project.dataspace)
758+
self.assertEqual(ScanCodeProject.ProjectType.IMPORT_SCAN_RESULTS, scancode_project.type)
759+
self.assertTrue(scancode_project.input_file.name.endswith("import_from_scan.json"))
760+
self.assertEqual(self.super_user, scancode_project.created_by)
761+
self.assertEqual(ScanCodeProject.Status.SUCCESS, scancode_project.status)
762+
extecped = [
763+
"- Imported 1 packages",
764+
"- Imported 1 product packages",
765+
"- Imported 3 codebase resources",
766+
]
767+
self.assertEqual(extecped, scancode_project.import_log)
768+
754769
# Make sure we do not create duplicates on re-importing
755770
upload_file = wrap_as_temp_uploaded_file(scan_input_location)
756771
importer = ImportFromScan(self.product1, self.super_user, upload_file)
757772
warnings, created_counts = importer.save()
758773
self.assertEqual([], warnings)
759774
self.assertEqual({}, created_counts)
775+
scancode_project = importer.scancode_project
776+
self.assertEqual(ScanCodeProject.Status.WARNING, scancode_project.status)
777+
self.assertEqual(["Nothing imported."], scancode_project.import_log)
760778

761779
def test_product_portfolio_product_import_from_scan_scanpipe_results(self):
762780
scan_input_location = self.testfiles_path / "scancodeio_scan_codebase_results.json"

0 commit comments

Comments
 (0)