Skip to content

Commit

Permalink
Fix the test_scanpipe_cyclonedx_resolve_license test #807
Browse files Browse the repository at this point in the history
Signed-off-by: tdruez <[email protected]>
  • Loading branch information
tdruez committed Jan 23, 2024
1 parent cc18a26 commit 35a7f23
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions scanpipe/tests/pipes/test_cyclonedx.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@
from hoppr_cyclonedx_models.cyclonedx_1_4 import (
CyclonedxSoftwareBillOfMaterialsStandard as Bom_1_4,
)
from hoppr_cyclonedx_models.cyclonedx_1_4 import License
from hoppr_cyclonedx_models.cyclonedx_1_4 import LicenseChoice

from scanpipe.pipes import cyclonedx

# from hoppr_cyclonedx_models.cyclonedx_1_4 import License1
# from hoppr_cyclonedx_models.cyclonedx_1_4 import LicenseChoice
# from hoppr_cyclonedx_models.cyclonedx_1_4 import License
# from hoppr_cyclonedx_models.cyclonedx_1_4 import LicenseChoice1


class ScanPipeCycloneDXPipesTest(TestCase):
bom_file = Path(__file__).parent.parent / "data/cyclonedx/nested.cdx.json"
Expand Down Expand Up @@ -149,18 +146,16 @@ def test_scanpipe_cyclonedx_recursive_component_collector(self):

self.assertEqual(result, expected)

# def test_scanpipe_cyclonedx_resolve_license(self):
# hopper_cdx_licensechoice_id = LicenseChoice(
# __root__=LicenseChoice1(license=License1(__root__=License(id="OFL-1.1")))
# )
# license_choice_dict = json.loads(
# hopper_cdx_licensechoice_id.json(exclude_unset=True, by_alias=True)
# )
#
# result = cyclonedx.resolve_license(license_choice_dict)
# expected = "OFL-1.1"
#
# self.assertEqual(result, expected)
def test_scanpipe_cyclonedx_resolve_license(self):
hopper_cdx_licensechoice_id = LicenseChoice(license=License(id="OFL-1.1"))
license_choice_dict = json.loads(
hopper_cdx_licensechoice_id.json(exclude_unset=True, by_alias=True)
)

result = cyclonedx.resolve_license(license_choice_dict)
expected = "OFL-1.1"

self.assertEqual(result, expected)

def test_scanpipe_cyclonedx_get_declared_licenses(self):
component = self.bom.components[0]
Expand Down

0 comments on commit 35a7f23

Please sign in to comment.