Skip to content

Commit 39a5f8f

Browse files
committed
chore(test): updated model get_bom_with_provides
Signed-off-by: Uzair Chhapra <[email protected]>
1 parent 3b4f790 commit 39a5f8f

15 files changed

+365
-346
lines changed

tests/_data/models.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,25 +1407,26 @@ def get_bom_with_definitions_and_detailed_standards() -> Bom:
14071407

14081408

14091409
def get_bom_with_provides() -> Bom:
1410-
c1 = get_component_toml_with_hashes_with_references('crypto-library')
1411-
c2 = get_component_setuptools_simple('some-library')
1412-
c3 = get_component_crypto_asset_algorithm('crypto-algorithm')
1413-
return _make_bom(
1414-
components=[c1, c2, c3],
1415-
dependencies=[
1416-
Dependency(
1417-
ref=c1.bom_ref,
1418-
dependencies=[Dependency(ref=c2.bom_ref)],
1419-
provides=[Dependency(ref=c3.bom_ref)]
1420-
),
1421-
Dependency(
1422-
ref=c2.bom_ref
1423-
),
1424-
Dependency(
1425-
ref=c3.bom_ref
1426-
),
1427-
],
1428-
)
1410+
bom = _make_bom()
1411+
bom.metadata.component = root_component = Component(name='app A', bom_ref='A', type=ComponentType.APPLICATION)
1412+
bom.components.add(
1413+
c1 := Component(name='device B', bom_ref='B', type=ComponentType.DEVICE))
1414+
bom.components.add(
1415+
c2 := Component(name='device C', bom_ref='C', type=ComponentType.DEVICE))
1416+
bom.dependencies = [
1417+
Dependency(
1418+
ref=c2.bom_ref
1419+
),
1420+
Dependency(
1421+
ref=c1.bom_ref,
1422+
provides=[Dependency(ref=c2.bom_ref)]
1423+
),
1424+
Dependency(
1425+
ref=root_component.bom_ref,
1426+
dependencies=[Dependency(ref=c2.bom_ref)]
1427+
),
1428+
]
1429+
return bom
14291430

14301431

14311432
def get_bom_for_issue540_duplicate_components() -> Bom:

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

Lines changed: 0 additions & 113 deletions
This file was deleted.

tests/_data/snapshots/get_bom_v1_6_with_provides-1.6.xml.bin

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" ?>
2+
<bom xmlns="http://cyclonedx.org/schema/bom/1.0" version="1">
3+
<components>
4+
<component type="device">
5+
<name>device B</name>
6+
<version/>
7+
<modified>false</modified>
8+
</component>
9+
<component type="device">
10+
<name>device C</name>
11+
<version/>
12+
<modified>false</modified>
13+
</component>
14+
</components>
15+
</bom>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
<component type="device" bom-ref="B">
5+
<name>device B</name>
6+
<version/>
7+
</component>
8+
<component type="device" bom-ref="C">
9+
<name>device C</name>
10+
<version/>
11+
</component>
12+
</components>
13+
</bom>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"components": [
3+
{
4+
"bom-ref": "B",
5+
"name": "device B",
6+
"type": "device",
7+
"version": ""
8+
},
9+
{
10+
"bom-ref": "C",
11+
"name": "device C",
12+
"type": "device",
13+
"version": ""
14+
}
15+
],
16+
"dependencies": [
17+
{
18+
"dependsOn": [
19+
"C"
20+
],
21+
"ref": "A"
22+
},
23+
{
24+
"ref": "B"
25+
},
26+
{
27+
"ref": "C"
28+
}
29+
],
30+
"metadata": {
31+
"component": {
32+
"bom-ref": "A",
33+
"name": "app A",
34+
"type": "application",
35+
"version": ""
36+
},
37+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
38+
},
39+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
40+
"version": 1,
41+
"$schema": "http://cyclonedx.org/schema/bom-1.2b.schema.json",
42+
"bomFormat": "CycloneDX",
43+
"specVersion": "1.2"
44+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
<component type="application" bom-ref="A">
6+
<name>app A</name>
7+
<version/>
8+
</component>
9+
</metadata>
10+
<components>
11+
<component type="device" bom-ref="B">
12+
<name>device B</name>
13+
<version/>
14+
</component>
15+
<component type="device" bom-ref="C">
16+
<name>device C</name>
17+
<version/>
18+
</component>
19+
</components>
20+
<dependencies>
21+
<dependency ref="A">
22+
<dependency ref="C"/>
23+
</dependency>
24+
<dependency ref="B"/>
25+
<dependency ref="C"/>
26+
</dependencies>
27+
</bom>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"components": [
3+
{
4+
"bom-ref": "B",
5+
"name": "device B",
6+
"type": "device",
7+
"version": ""
8+
},
9+
{
10+
"bom-ref": "C",
11+
"name": "device C",
12+
"type": "device",
13+
"version": ""
14+
}
15+
],
16+
"dependencies": [
17+
{
18+
"dependsOn": [
19+
"C"
20+
],
21+
"ref": "A"
22+
},
23+
{
24+
"ref": "B"
25+
},
26+
{
27+
"ref": "C"
28+
}
29+
],
30+
"metadata": {
31+
"component": {
32+
"bom-ref": "A",
33+
"name": "app A",
34+
"type": "application",
35+
"version": ""
36+
},
37+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
38+
},
39+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
40+
"version": 1,
41+
"$schema": "http://cyclonedx.org/schema/bom-1.3a.schema.json",
42+
"bomFormat": "CycloneDX",
43+
"specVersion": "1.3"
44+
}

0 commit comments

Comments
 (0)