Skip to content

Commit

Permalink
Add test case for duplicate components produced by cyclonedx-cli merge
Browse files Browse the repository at this point in the history
Addresses #677

Signed-off-by: wkoot <3715211+wkoot@users.noreply.github.com>
  • Loading branch information
wkoot committed Sep 19, 2024
1 parent 0d1cbe0 commit 1caaaf5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/_data/own/json/1.5/duplicate_components.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions tests/test_real_world_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import unittest
from datetime import datetime
from json import loads as json_loads
from os.path import join
from typing import Any
from unittest.mock import patch
Expand All @@ -36,3 +37,10 @@ def test_webgoat_6_1(self, *_: Any, **__: Any) -> None:
def test_regression_issue_630(self, *_: Any, **__: Any) -> None:
with open(join(OWN_DATA_DIRECTORY, 'xml', '1.6', 'regression_issue630.xml')) as input_xml:
Bom.from_xml(input_xml)

def test_merged_bom_duplicate_component(self, *_: Any, **__: Any) -> None:
with open(join(OWN_DATA_DIRECTORY, 'json', '1.5', 'duplicate_components.json')) as input_json:
json = json_loads(input_json.read())

bom = Bom.from_json(json)
self.assertEqual(4, len(bom.components))

0 comments on commit 1caaaf5

Please sign in to comment.