Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,10 @@ def assertEqualJsonBom(self, a: str, b: str) -> None:

# Unify timestamps to ensure they will compare
now = datetime.now(tz=timezone.utc)

if 'metadata' in ab.keys():
ab['metadata']['timestamp'] = now.isoformat()
if 'tools' in ab['metadata'].keys():
for tool in ab['metadata']['tools']:
if tool['name'] == cyclonedx_lib_name:
tool['version'] = cyclonedx_lib_version
del tool

if 'metadata' in bb.keys():
bb['metadata']['timestamp'] = now.isoformat()
if 'tools' in bb['metadata'].keys():
for tool in bb['metadata']['tools']:
if tool['name'] == cyclonedx_lib_name:
tool['version'] = cyclonedx_lib_version
del tool

self.assertEqualJson(json.dumps(ab), json.dumps(bb))

Expand Down Expand Up @@ -156,19 +144,10 @@ def assertEqualXmlBom(self, a: str, b: str, namespace: str) -> None:
metadata_ts_a = ba.find('./{{{}}}metadata/{{{}}}timestamp'.format(namespace, namespace))
if metadata_ts_a is not None:
metadata_ts_a.text = now.isoformat()

metadata_ts_b = bb.find('./{{{}}}metadata/{{{}}}timestamp'.format(namespace, namespace))
if metadata_ts_b is not None:
metadata_ts_b.text = now.isoformat()

# Align 'this' Tool Version
this_tool = ba.find('.//*/{{{}}}tool[{{{}}}version="VERSION"]'.format(namespace, namespace))
if this_tool is not None:
this_tool.find('./{{{}}}version'.format(namespace)).text = cyclonedx_lib_version
this_tool = bb.find('.//*/{{{}}}tool[{{{}}}version="VERSION"]'.format(namespace, namespace))
if this_tool is not None:
this_tool.find('./{{{}}}version'.format(namespace)).text = cyclonedx_lib_version

self.assertEqualXml(
xml.etree.ElementTree.tostring(ba, 'unicode'),
xml.etree.ElementTree.tostring(bb, 'unicode')
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_dependencies_component.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_external_references.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_issue_275_components.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_issue_328_components.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_services_complex.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_services_nested.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_services_simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_setuptools.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_setuptools_complete.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_setuptools_with_cpe.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_toml_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.2/bom_with_full_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_dependencies_component.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_external_references.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_issue_275_components.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_issue_328_components.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_services_complex.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_services_nested.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_services_simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"component": {
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_setuptools.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_setuptools_complete.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_setuptools_no_version.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_setuptools_with_cpe.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_toml_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.3/bom_with_full_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2"
"version": "TESTING"
}
],
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_dependencies_component.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_external_references.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_issue_275_components.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_issue_328_components.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_services_complex.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_services_nested.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_services_simple.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_setuptools.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_setuptools_complete.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_setuptools_no_version.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/json/1.4/bom_setuptools_with_cpe.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"vendor": "CycloneDX",
"name": "cyclonedx-python-lib",
"version": "3.1.2",
"version": "TESTING",
"externalReferences": [
{
"url": "https://github.com/CycloneDX/cyclonedx-python-lib/actions",
Expand Down
Loading