Skip to content

Commit 1caaaf5

Browse files
committed
Add test case for duplicate components produced by cyclonedx-cli merge
Addresses CycloneDX#677 Signed-off-by: wkoot <[email protected]>
1 parent 0d1cbe0 commit 1caaaf5

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

tests/_data/own/json/1.5/duplicate_components.json

+48
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test_real_world_examples.py

+8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import unittest
1919
from datetime import datetime
20+
from json import loads as json_loads
2021
from os.path import join
2122
from typing import Any
2223
from unittest.mock import patch
@@ -36,3 +37,10 @@ def test_webgoat_6_1(self, *_: Any, **__: Any) -> None:
3637
def test_regression_issue_630(self, *_: Any, **__: Any) -> None:
3738
with open(join(OWN_DATA_DIRECTORY, 'xml', '1.6', 'regression_issue630.xml')) as input_xml:
3839
Bom.from_xml(input_xml)
40+
41+
def test_merged_bom_duplicate_component(self, *_: Any, **__: Any) -> None:
42+
with open(join(OWN_DATA_DIRECTORY, 'json', '1.5', 'duplicate_components.json')) as input_json:
43+
json = json_loads(input_json.read())
44+
45+
bom = Bom.from_json(json)
46+
self.assertEqual(4, len(bom.components))

0 commit comments

Comments
 (0)