[elbe-devel] [PATCH 1/3] elbepack: cyclonedx-sbom: use valid serialNumber in reference tests
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Fri Jul 5 15:28:46 CEST 2024
We want the reference data itself to satisfy the schema.
Instead of the non-UUID string "INVALID" use the null UUID.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/tests/cyclonedx/cyclonedx_reference.json | 2 +-
elbepack/tests/cyclonedx/test_cyclonedx_sbom.py | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/elbepack/tests/cyclonedx/cyclonedx_reference.json b/elbepack/tests/cyclonedx/cyclonedx_reference.json
index d1c64a6bc35e..7fdba67878b8 100644
--- a/elbepack/tests/cyclonedx/cyclonedx_reference.json
+++ b/elbepack/tests/cyclonedx/cyclonedx_reference.json
@@ -1,7 +1,7 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
- "serialNumber": "INVALID",
+ "serialNumber": "urn:uuid:00000000-0000-0000-0000-000000000000",
"version": 1,
"metadata": {
"timestamp": "INVALID",
diff --git a/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py b/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py
index 4bd911d3a608..b50c9fc8d1ac 100644
--- a/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py
+++ b/elbepack/tests/cyclonedx/test_cyclonedx_sbom.py
@@ -4,6 +4,7 @@
import json
import pathlib
+import uuid
import jsonschema
@@ -30,7 +31,7 @@ def test_schema():
def test_reference_data():
test_bom = generate_test_bom()
test_bom['metadata']['timestamp'] = 'INVALID'
- test_bom['serialNumber'] = 'INVALID'
+ test_bom['serialNumber'] = uuid.UUID(int=0).urn
test_bom['metadata']['tools'][0]['version'] = 'INVALID'
with here.joinpath('cyclonedx_reference.json').open() as f:
reference_data = json.load(f)
--
2.45.2
More information about the elbe-devel
mailing list