Skip to content

Commit 3032416

Browse files
committed
tests
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent a3b5eca commit 3032416

21 files changed

+471
-3
lines changed

tests/_data/models.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
Note,
3939
NoteText,
4040
Property,
41+
ThisTool,
4142
XsUri,
4243
)
4344
from cyclonedx.model.bom import Bom, BomMetaData
@@ -494,9 +495,9 @@ def get_bom_with_component_setuptools_with_vulnerability() -> Bom:
494495
],
495496
individuals=[get_org_contact_2()]
496497
),
497-
tools=[
498-
Tool(vendor='CycloneDX', name='cyclonedx-python-lib')
499-
],
498+
tools=ToolsRepository(tools=(
499+
Tool(vendor='CycloneDX', name='cyclonedx-python-lib'),
500+
)),
500501
analysis=VulnerabilityAnalysis(
501502
state=ImpactAnalysisState.EXPLOITABLE, justification=ImpactAnalysisJustification.REQUIRES_ENVIRONMENT,
502503
responses=[ImpactAnalysisResponse.CAN_NOT_FIX], detail='Some extra detail'
@@ -1051,6 +1052,7 @@ def get_bom_with_tools() -> Bom:
10511052
return _make_bom(
10521053
metadata=BomMetaData(
10531054
tools=(
1055+
ThisTool,
10541056
Tool(name='test-tool-b'),
10551057
Tool(vendor='example',
10561058
name='test-tool-a',
@@ -1154,6 +1156,7 @@ def get_bom_with_tools_with_component_and_service_and_tools_migrate() -> Bom:
11541156
),
11551157
))
11561158
ttools.update((
1159+
ThisTool,
11571160
Tool(name='test-tool-b'),
11581161
Tool(vendor='example',
11591162
name='test-tool-a',
@@ -1255,6 +1258,11 @@ def get_bom_for_issue_630_empty_property() -> Bom:
12551258
if n.startswith('get_bom_') and not n.endswith('_invalid') and not n.endswith('_migrate')
12561259
)
12571260

1261+
all_get_bom_funct_valid_migrate = tuple(
1262+
(n, f) for n, f in getmembers(sys.modules[__name__], isfunction)
1263+
if n.endswith('_migrate')
1264+
)
1265+
12581266
all_get_bom_funct_invalid = tuple(
12591267
(n, f) for n, f in getmembers(sys.modules[__name__], isfunction)
12601268
if n.startswith('get_bom_') and n.endswith('_invalid')

tests/_data/snapshots/get_bom_with_tools-1.2.json.bin

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
"metadata": {
33
"timestamp": "2023-01-07T13:44:32.312678+00:00",
44
"tools": [
5+
{
6+
"name": "cyclonedx-python-lib",
7+
"vendor": "CycloneDX",
8+
"version": "TESTING"
9+
},
510
{
611
"hashes": [
712
{

tests/_data/snapshots/get_bom_with_tools-1.2.xml.bin

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
<metadata>
44
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
55
<tools>
6+
<tool>
7+
<vendor>CycloneDX</vendor>
8+
<name>cyclonedx-python-lib</name>
9+
<version>TESTING</version>
10+
</tool>
611
<tool>
712
<vendor>example</vendor>
813
<name>test-tool-a</name>

tests/_data/snapshots/get_bom_with_tools-1.3.json.bin

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
"metadata": {
33
"timestamp": "2023-01-07T13:44:32.312678+00:00",
44
"tools": [
5+
{
6+
"name": "cyclonedx-python-lib",
7+
"vendor": "CycloneDX",
8+
"version": "TESTING"
9+
},
510
{
611
"hashes": [
712
{

tests/_data/snapshots/get_bom_with_tools-1.3.xml.bin

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
<metadata>
44
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
55
<tools>
6+
<tool>
7+
<vendor>CycloneDX</vendor>
8+
<name>cyclonedx-python-lib</name>
9+
<version>TESTING</version>
10+
</tool>
611
<tool>
712
<vendor>example</vendor>
813
<name>test-tool-a</name>

tests/_data/snapshots/get_bom_with_tools-1.4.json.bin

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,45 @@
22
"metadata": {
33
"timestamp": "2023-01-07T13:44:32.312678+00:00",
44
"tools": [
5+
{
6+
"externalReferences": [
7+
{
8+
"type": "build-system",
9+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions"
10+
},
11+
{
12+
"type": "distribution",
13+
"url": "https://pypi.org/project/cyclonedx-python-lib/"
14+
},
15+
{
16+
"type": "documentation",
17+
"url": "https://cyclonedx-python-library.readthedocs.io/"
18+
},
19+
{
20+
"type": "issue-tracker",
21+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/issues"
22+
},
23+
{
24+
"type": "license",
25+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/LICENSE"
26+
},
27+
{
28+
"type": "release-notes",
29+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/CHANGELOG.md"
30+
},
31+
{
32+
"type": "vcs",
33+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib"
34+
},
35+
{
36+
"type": "website",
37+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/#readme"
38+
}
39+
],
40+
"name": "cyclonedx-python-lib",
41+
"vendor": "CycloneDX",
42+
"version": "TESTING"
43+
},
544
{
645
"externalReferences": [
746
{

tests/_data/snapshots/get_bom_with_tools-1.4.xml.bin

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,37 @@
33
<metadata>
44
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
55
<tools>
6+
<tool>
7+
<vendor>CycloneDX</vendor>
8+
<name>cyclonedx-python-lib</name>
9+
<version>TESTING</version>
10+
<externalReferences>
11+
<reference type="build-system">
12+
<url>https://github.com/CycloneDX/cyclonedx-python-lib/actions</url>
13+
</reference>
14+
<reference type="distribution">
15+
<url>https://pypi.org/project/cyclonedx-python-lib/</url>
16+
</reference>
17+
<reference type="documentation">
18+
<url>https://cyclonedx-python-library.readthedocs.io/</url>
19+
</reference>
20+
<reference type="issue-tracker">
21+
<url>https://github.com/CycloneDX/cyclonedx-python-lib/issues</url>
22+
</reference>
23+
<reference type="license">
24+
<url>https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/LICENSE</url>
25+
</reference>
26+
<reference type="release-notes">
27+
<url>https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/CHANGELOG.md</url>
28+
</reference>
29+
<reference type="vcs">
30+
<url>https://github.com/CycloneDX/cyclonedx-python-lib</url>
31+
</reference>
32+
<reference type="website">
33+
<url>https://github.com/CycloneDX/cyclonedx-python-lib/#readme</url>
34+
</reference>
35+
</externalReferences>
36+
</tool>
637
<tool>
738
<vendor>example</vendor>
839
<name>test-tool-a</name>

tests/_data/snapshots/get_bom_with_tools-1.5.json.bin

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,45 @@
22
"metadata": {
33
"timestamp": "2023-01-07T13:44:32.312678+00:00",
44
"tools": [
5+
{
6+
"externalReferences": [
7+
{
8+
"type": "build-system",
9+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions"
10+
},
11+
{
12+
"type": "distribution",
13+
"url": "https://pypi.org/project/cyclonedx-python-lib/"
14+
},
15+
{
16+
"type": "documentation",
17+
"url": "https://cyclonedx-python-library.readthedocs.io/"
18+
},
19+
{
20+
"type": "issue-tracker",
21+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/issues"
22+
},
23+
{
24+
"type": "license",
25+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/LICENSE"
26+
},
27+
{
28+
"type": "release-notes",
29+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/CHANGELOG.md"
30+
},
31+
{
32+
"type": "vcs",
33+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib"
34+
},
35+
{
36+
"type": "website",
37+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/#readme"
38+
}
39+
],
40+
"name": "cyclonedx-python-lib",
41+
"vendor": "CycloneDX",
42+
"version": "TESTING"
43+
},
544
{
645
"externalReferences": [
746
{

tests/_data/snapshots/get_bom_with_tools-1.5.xml.bin

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,37 @@
33
<metadata>
44
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
55
<tools>
6+
<tool>
7+
<vendor>CycloneDX</vendor>
8+
<name>cyclonedx-python-lib</name>
9+
<version>TESTING</version>
10+
<externalReferences>
11+
<reference type="build-system">
12+
<url>https://github.com/CycloneDX/cyclonedx-python-lib/actions</url>
13+
</reference>
14+
<reference type="distribution">
15+
<url>https://pypi.org/project/cyclonedx-python-lib/</url>
16+
</reference>
17+
<reference type="documentation">
18+
<url>https://cyclonedx-python-library.readthedocs.io/</url>
19+
</reference>
20+
<reference type="issue-tracker">
21+
<url>https://github.com/CycloneDX/cyclonedx-python-lib/issues</url>
22+
</reference>
23+
<reference type="license">
24+
<url>https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/LICENSE</url>
25+
</reference>
26+
<reference type="release-notes">
27+
<url>https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/CHANGELOG.md</url>
28+
</reference>
29+
<reference type="vcs">
30+
<url>https://github.com/CycloneDX/cyclonedx-python-lib</url>
31+
</reference>
32+
<reference type="website">
33+
<url>https://github.com/CycloneDX/cyclonedx-python-lib/#readme</url>
34+
</reference>
35+
</externalReferences>
36+
</tool>
637
<tool>
738
<vendor>example</vendor>
839
<name>test-tool-a</name>

tests/_data/snapshots/get_bom_with_tools-1.6.json.bin

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,45 @@
22
"metadata": {
33
"timestamp": "2023-01-07T13:44:32.312678+00:00",
44
"tools": [
5+
{
6+
"externalReferences": [
7+
{
8+
"type": "build-system",
9+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions"
10+
},
11+
{
12+
"type": "distribution",
13+
"url": "https://pypi.org/project/cyclonedx-python-lib/"
14+
},
15+
{
16+
"type": "documentation",
17+
"url": "https://cyclonedx-python-library.readthedocs.io/"
18+
},
19+
{
20+
"type": "issue-tracker",
21+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/issues"
22+
},
23+
{
24+
"type": "license",
25+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/LICENSE"
26+
},
27+
{
28+
"type": "release-notes",
29+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/blob/main/CHANGELOG.md"
30+
},
31+
{
32+
"type": "vcs",
33+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib"
34+
},
35+
{
36+
"type": "website",
37+
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/#readme"
38+
}
39+
],
40+
"name": "cyclonedx-python-lib",
41+
"vendor": "CycloneDX",
42+
"version": "TESTING"
43+
},
544
{
645
"externalReferences": [
746
{

0 commit comments

Comments
 (0)