Skip to content

Commit

Permalink
feat: add test fixtures related to bom.definitions
Browse files Browse the repository at this point in the history
for #697

Signed-off-by: Hakan Dilek <hakandilek@gmail.com>
  • Loading branch information
hakandilek committed Oct 21, 2024
1 parent 953718e commit c1b35b7
Show file tree
Hide file tree
Showing 13 changed files with 164 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/_data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
RelatedCryptoMaterialState,
RelatedCryptoMaterialType,
)
from cyclonedx.model.definition import Definitions, Standard
from cyclonedx.model.dependency import Dependency
from cyclonedx.model.impact_analysis import (
ImpactAnalysisAffectedStatus,
Expand Down Expand Up @@ -1285,7 +1286,20 @@ def get_bom_with_lifecycles() -> Bom:
description='Integration testing specific to the runtime platform'),
],
component=Component(name='app', type=ComponentType.APPLICATION, bom_ref='my-app'),
),
)
)


def get_bom_with_definitions_standards() -> Bom:
"""
Returns a BOM with definitions and standards only.
"""
return _make_bom(
definitions=Definitions(standards=[
Standard(name='Some Standard', version='1.2.3', description='Some description', bom_ref='some-standard',
owner='Some Owner', external_references=[get_external_reference_2()]
)
])
)


Expand Down Expand Up @@ -1335,4 +1349,5 @@ def get_bom_with_lifecycles() -> Bom:
get_bom_with_component_setuptools_with_v16_fields,
get_bom_for_issue_630_empty_property,
get_bom_with_lifecycles,
get_bom_with_definitions_standards,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.0" version="1">
<components/>
</bom>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.1" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<components/>
</bom>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"metadata": {
"timestamp": "2023-01-07T13:44:32.312678+00:00"
},
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
"version": 1,
"$schema": "http://cyclonedx.org/schema/bom-1.2b.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<metadata>
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
</metadata>
</bom>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"metadata": {
"timestamp": "2023-01-07T13:44:32.312678+00:00"
},
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
"version": 1,
"$schema": "http://cyclonedx.org/schema/bom-1.3a.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.3"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.3" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<metadata>
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
</metadata>
</bom>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"metadata": {
"timestamp": "2023-01-07T13:44:32.312678+00:00"
},
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
"version": 1,
"$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.4"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.4" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<metadata>
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
</metadata>
</bom>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"metadata": {
"timestamp": "2023-01-07T13:44:32.312678+00:00"
},
"properties": [
{
"name": "key1",
"value": "val1"
},
{
"name": "key2",
"value": "val2"
}
],
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
"version": 1,
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.5"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.5" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<metadata>
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
</metadata>
<properties>
<property name="key1">val1</property>
<property name="key2">val2</property>
</properties>
</bom>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"definitions": {
"standards": [
{
"bom-ref": "some-standard",
"description": "Some description",
"externalReferences": [
{
"type": "website",
"url": "https://cyclonedx.org"
}
],
"name": "Some Standard",
"owner": "Some Owner",
"version": "1.2.3"
}
]
},
"metadata": {
"timestamp": "2023-01-07T13:44:32.312678+00:00"
},
"properties": [
{
"name": "key1",
"value": "val1"
},
{
"name": "key2",
"value": "val2"
}
],
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
"version": 1,
"$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.6"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.6" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<metadata>
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
</metadata>
<properties>
<property name="key1">val1</property>
<property name="key2">val2</property>
</properties>
<definitions>
<standards>
<standard bom-ref="some-standard">
<name>Some Standard</name>
<version>1.2.3</version>
<description>Some description</description>
<owner>Some Owner</owner>
<externalReferences>
<reference type="website">
<url>https://cyclonedx.org</url>
</reference>
</externalReferences>
</standard>
</standards>
</definitions>
</bom>

0 comments on commit c1b35b7

Please sign in to comment.