Skip to content

Commit 2525660

Browse files
committed
chore(test): add test get_bom_with_provides_valid
Signed-off-by: Uzair Chhapra <[email protected]>
1 parent 8cdb39b commit 2525660

File tree

3 files changed

+212
-0
lines changed

3 files changed

+212
-0
lines changed

tests/_data/models.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,28 @@ def get_bom_with_definitions_standards() -> Bom:
13101310
)
13111311

13121312

1313+
def get_bom_with_provides_valid() -> Bom:
1314+
c1 = get_component_toml_with_hashes_with_references('crypto-library')
1315+
c2 = get_component_setuptools_simple('some-library')
1316+
c3 = get_component_crypto_asset_algorithm('crypto-algorithm')
1317+
return _make_bom(
1318+
components=[c1, c2, c3],
1319+
dependencies=[
1320+
Dependency(
1321+
ref=c1.bom_ref,
1322+
dependencies=[Dependency(ref=c2.bom_ref)],
1323+
provides=[Dependency(ref=c3.bom_ref)]
1324+
),
1325+
Dependency(
1326+
ref=c2.bom_ref
1327+
),
1328+
Dependency(
1329+
ref=c3.bom_ref
1330+
),
1331+
],
1332+
)
1333+
1334+
13131335
# ---
13141336

13151337

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"components": [
3+
{
4+
"bom-ref": "crypto-algorithm",
5+
"cryptoProperties": {
6+
"algorithmProperties": {
7+
"certificationLevel": [
8+
"fips140-1-l1",
9+
"fips140-2-l3",
10+
"other"
11+
],
12+
"classicalSecurityLevel": 2,
13+
"cryptoFunctions": [
14+
"sign",
15+
"unknown"
16+
],
17+
"curve": "9n8y2oxty3ao83n8qc2g2x3qcw4jt4wj",
18+
"executionEnvironment": "software-plain-ram",
19+
"implementationPlatform": "generic",
20+
"mode": "ecb",
21+
"nistQuantumSecurityLevel": 2,
22+
"padding": "pkcs7",
23+
"parameterSetIdentifier": "a-parameter-set-id",
24+
"primitive": "kem"
25+
},
26+
"assetType": "algorithm",
27+
"oid": "an-oid-here"
28+
},
29+
"name": "My Algorithm",
30+
"tags": [
31+
"algorithm"
32+
],
33+
"type": "cryptographic-asset",
34+
"version": "1.0"
35+
},
36+
{
37+
"author": "Test Author",
38+
"bom-ref": "some-library",
39+
"licenses": [
40+
{
41+
"license": {
42+
"id": "MIT"
43+
}
44+
}
45+
],
46+
"name": "setuptools",
47+
"purl": "pkg:pypi/[email protected]?extension=tar.gz",
48+
"type": "library",
49+
"version": "50.3.2"
50+
},
51+
{
52+
"bom-ref": "crypto-library",
53+
"externalReferences": [
54+
{
55+
"comment": "No comment",
56+
"hashes": [
57+
{
58+
"alg": "SHA-256",
59+
"content": "806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"
60+
}
61+
],
62+
"type": "distribution",
63+
"url": "https://cyclonedx.org"
64+
}
65+
],
66+
"hashes": [
67+
{
68+
"alg": "SHA-256",
69+
"content": "806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"
70+
}
71+
],
72+
"name": "toml",
73+
"purl": "pkg:pypi/[email protected]?extension=tar.gz",
74+
"type": "library",
75+
"version": "0.10.2"
76+
}
77+
],
78+
"dependencies": [
79+
{
80+
"ref": "crypto-algorithm"
81+
},
82+
{
83+
"dependsOn": [
84+
"some-library"
85+
],
86+
"provides": [
87+
"crypto-algorithm"
88+
],
89+
"ref": "crypto-library"
90+
},
91+
{
92+
"ref": "some-library"
93+
}
94+
],
95+
"metadata": {
96+
"timestamp": "2023-01-07T13:44:32.312678+00:00"
97+
},
98+
"properties": [
99+
{
100+
"name": "key1",
101+
"value": "val1"
102+
},
103+
{
104+
"name": "key2",
105+
"value": "val2"
106+
}
107+
],
108+
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
109+
"version": 1,
110+
"$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
111+
"bomFormat": "CycloneDX",
112+
"specVersion": "1.6"
113+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
<components>
7+
<component type="cryptographic-asset" bom-ref="crypto-algorithm">
8+
<name>My Algorithm</name>
9+
<version>1.0</version>
10+
<cryptoProperties>
11+
<assetType>algorithm</assetType>
12+
<algorithmProperties>
13+
<primitive>kem</primitive>
14+
<parameterSetIdentifier>a-parameter-set-id</parameterSetIdentifier>
15+
<curve>9n8y2oxty3ao83n8qc2g2x3qcw4jt4wj</curve>
16+
<executionEnvironment>software-plain-ram</executionEnvironment>
17+
<implementationPlatform>generic</implementationPlatform>
18+
<certificationLevel>fips140-1-l1</certificationLevel>
19+
<certificationLevel>fips140-2-l3</certificationLevel>
20+
<certificationLevel>other</certificationLevel>
21+
<mode>ecb</mode>
22+
<padding>pkcs7</padding>
23+
<cryptoFunctions>
24+
<cryptoFunction>sign</cryptoFunction>
25+
<cryptoFunction>unknown</cryptoFunction>
26+
</cryptoFunctions>
27+
<classicalSecurityLevel>2</classicalSecurityLevel>
28+
<nistQuantumSecurityLevel>2</nistQuantumSecurityLevel>
29+
</algorithmProperties>
30+
<oid>an-oid-here</oid>
31+
</cryptoProperties>
32+
<tags>
33+
<tag>algorithm</tag>
34+
</tags>
35+
</component>
36+
<component type="library" bom-ref="some-library">
37+
<author>Test Author</author>
38+
<name>setuptools</name>
39+
<version>50.3.2</version>
40+
<licenses>
41+
<license>
42+
<id>MIT</id>
43+
</license>
44+
</licenses>
45+
<purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
46+
</component>
47+
<component type="library" bom-ref="crypto-library">
48+
<name>toml</name>
49+
<version>0.10.2</version>
50+
<hashes>
51+
<hash alg="SHA-256">806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b</hash>
52+
</hashes>
53+
<purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
54+
<externalReferences>
55+
<reference type="distribution">
56+
<url>https://cyclonedx.org</url>
57+
<comment>No comment</comment>
58+
<hashes>
59+
<hash alg="SHA-256">806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b</hash>
60+
</hashes>
61+
</reference>
62+
</externalReferences>
63+
</component>
64+
</components>
65+
<dependencies>
66+
<dependency ref="crypto-algorithm"/>
67+
<dependency ref="crypto-library">
68+
<dependency ref="some-library"/>
69+
<provides ref="crypto-algorithm"/>
70+
</dependency>
71+
<dependency ref="some-library"/>
72+
</dependencies>
73+
<properties>
74+
<property name="key1">val1</property>
75+
<property name="key2">val2</property>
76+
</properties>
77+
</bom>

0 commit comments

Comments
 (0)