Skip to content

Commit 640a904

Browse files
committed
Add tests in tests/_data/models.py, remove current
Signed-off-by: yowgf <[email protected]>
1 parent 3c9f234 commit 640a904

14 files changed

+209
-63
lines changed

tests/_data/models.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,6 +1437,26 @@ def get_bom_for_issue540_duplicate_components() -> Bom:
14371437
bom.register_dependency(component1, [component3])
14381438
return bom
14391439

1440+
1441+
def get_bom_for_issue799_organizational_entity_bom_ref() -> Bom:
1442+
"""regression test for issue #799
1443+
see https://github.com/CycloneDX/cyclonedx-python-lib/issues/799
1444+
"""
1445+
return _make_bom(
1446+
metadata=BomMetaData(
1447+
tools=ToolRepository(
1448+
services=(
1449+
Service(name='service-1',
1450+
provider=OrganizationalEntity(
1451+
name='org-1',
1452+
bom_ref=BomRef('bom-ref-1'),
1453+
)),
1454+
)
1455+
)
1456+
)
1457+
)
1458+
1459+
14401460
# ---
14411461

14421462

Lines changed: 4 additions & 0 deletions
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>
Lines changed: 4 additions & 0 deletions
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>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"metadata": {
3+
"timestamp": "2023-01-07T13:44:32.312678+00:00",
4+
"tools": [
5+
{
6+
"name": "service-1"
7+
}
8+
]
9+
},
10+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
11+
"version": 1,
12+
"$schema": "http://cyclonedx.org/schema/bom-1.2b.schema.json",
13+
"bomFormat": "CycloneDX",
14+
"specVersion": "1.2"
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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+
<tools>
6+
<tool>
7+
<name>service-1</name>
8+
</tool>
9+
</tools>
10+
</metadata>
11+
</bom>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"metadata": {
3+
"timestamp": "2023-01-07T13:44:32.312678+00:00",
4+
"tools": [
5+
{
6+
"name": "service-1"
7+
}
8+
]
9+
},
10+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
11+
"version": 1,
12+
"$schema": "http://cyclonedx.org/schema/bom-1.3a.schema.json",
13+
"bomFormat": "CycloneDX",
14+
"specVersion": "1.3"
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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+
<tools>
6+
<tool>
7+
<name>service-1</name>
8+
</tool>
9+
</tools>
10+
</metadata>
11+
</bom>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"metadata": {
3+
"timestamp": "2023-01-07T13:44:32.312678+00:00",
4+
"tools": [
5+
{
6+
"name": "service-1"
7+
}
8+
]
9+
},
10+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
11+
"version": 1,
12+
"$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json",
13+
"bomFormat": "CycloneDX",
14+
"specVersion": "1.4"
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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+
<tools>
6+
<tool>
7+
<name>service-1</name>
8+
</tool>
9+
</tools>
10+
</metadata>
11+
</bom>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"metadata": {
3+
"timestamp": "2023-01-07T13:44:32.312678+00:00",
4+
"tools": {
5+
"services": [
6+
{
7+
"name": "service-1",
8+
"provider": {
9+
"bom-ref": "bom-ref-1",
10+
"name": "org-1"
11+
}
12+
}
13+
]
14+
}
15+
},
16+
"properties": [
17+
{
18+
"name": "key1",
19+
"value": "val1"
20+
},
21+
{
22+
"name": "key2",
23+
"value": "val2"
24+
}
25+
],
26+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
27+
"version": 1,
28+
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
29+
"bomFormat": "CycloneDX",
30+
"specVersion": "1.5"
31+
}

0 commit comments

Comments
 (0)