Skip to content

Commit 20dbbc0

Browse files
committed
feat: add test fixtures related to bom.definitions
for #697 Signed-off-by: Hakan Dilek <[email protected]>
1 parent a77f217 commit 20dbbc0

13 files changed

+164
-1
lines changed

tests/_data/models.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
RelatedCryptoMaterialState,
7979
RelatedCryptoMaterialType,
8080
)
81+
from cyclonedx.model.definition import Definitions, Standard
8182
from cyclonedx.model.dependency import Dependency
8283
from cyclonedx.model.impact_analysis import (
8384
ImpactAnalysisAffectedStatus,
@@ -1285,7 +1286,20 @@ def get_bom_with_lifecycles() -> Bom:
12851286
description='Integration testing specific to the runtime platform'),
12861287
],
12871288
component=Component(name='app', type=ComponentType.APPLICATION, bom_ref='my-app'),
1288-
),
1289+
)
1290+
)
1291+
1292+
1293+
def get_bom_with_definitions_standards() -> Bom:
1294+
"""
1295+
Returns a BOM with definitions and standards only.
1296+
"""
1297+
return _make_bom(
1298+
definitions=Definitions(standards=[
1299+
Standard(name='Some Standard', version='1.2.3', description='Some description', bom_ref='some-standard',
1300+
owner='Some Owner', external_references=[get_external_reference_2()]
1301+
)
1302+
])
12891303
)
12901304

12911305

@@ -1335,4 +1349,5 @@ def get_bom_with_lifecycles() -> Bom:
13351349
get_bom_with_component_setuptools_with_v16_fields,
13361350
get_bom_for_issue_630_empty_property,
13371351
get_bom_with_lifecycles,
1352+
get_bom_with_definitions_standards,
13381353
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.0" version="1">
3+
<components/>
4+
</bom>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.1" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
3+
<components/>
4+
</bom>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"metadata": {
3+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
4+
},
5+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
6+
"version": 1,
7+
"$schema": "http://cyclonedx.org/schema/bom-1.2b.schema.json",
8+
"bomFormat": "CycloneDX",
9+
"specVersion": "1.2"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
3+
<metadata>
4+
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
5+
</metadata>
6+
</bom>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"metadata": {
3+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
4+
},
5+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
6+
"version": 1,
7+
"$schema": "http://cyclonedx.org/schema/bom-1.3a.schema.json",
8+
"bomFormat": "CycloneDX",
9+
"specVersion": "1.3"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.3" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
3+
<metadata>
4+
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
5+
</metadata>
6+
</bom>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"metadata": {
3+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
4+
},
5+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
6+
"version": 1,
7+
"$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json",
8+
"bomFormat": "CycloneDX",
9+
"specVersion": "1.4"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.4" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
3+
<metadata>
4+
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
5+
</metadata>
6+
</bom>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"metadata": {
3+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
4+
},
5+
"properties": [
6+
{
7+
"name": "key1",
8+
"value": "val1"
9+
},
10+
{
11+
"name": "key2",
12+
"value": "val2"
13+
}
14+
],
15+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
16+
"version": 1,
17+
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
18+
"bomFormat": "CycloneDX",
19+
"specVersion": "1.5"
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.5" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
3+
<metadata>
4+
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
5+
</metadata>
6+
<properties>
7+
<property name="key1">val1</property>
8+
<property name="key2">val2</property>
9+
</properties>
10+
</bom>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"definitions": {
3+
"standards": [
4+
{
5+
"bom-ref": "some-standard",
6+
"description": "Some description",
7+
"externalReferences": [
8+
{
9+
"type": "website",
10+
"url": "https://cyclonedx.org"
11+
}
12+
],
13+
"name": "Some Standard",
14+
"owner": "Some Owner",
15+
"version": "1.2.3"
16+
}
17+
]
18+
},
19+
"metadata": {
20+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
21+
},
22+
"properties": [
23+
{
24+
"name": "key1",
25+
"value": "val1"
26+
},
27+
{
28+
"name": "key2",
29+
"value": "val2"
30+
}
31+
],
32+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
33+
"version": 1,
34+
"$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
35+
"bomFormat": "CycloneDX",
36+
"specVersion": "1.6"
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.6" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
3+
<metadata>
4+
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
5+
</metadata>
6+
<properties>
7+
<property name="key1">val1</property>
8+
<property name="key2">val2</property>
9+
</properties>
10+
<definitions>
11+
<standards>
12+
<standard bom-ref="some-standard">
13+
<name>Some Standard</name>
14+
<version>1.2.3</version>
15+
<description>Some description</description>
16+
<owner>Some Owner</owner>
17+
<externalReferences>
18+
<reference type="website">
19+
<url>https://cyclonedx.org</url>
20+
</reference>
21+
</externalReferences>
22+
</standard>
23+
</standards>
24+
</definitions>
25+
</bom>

0 commit comments

Comments
 (0)