Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Horton <[email protected]>
  • Loading branch information
madpah committed Apr 29, 2024
1 parent 362c986 commit 69b0519
Show file tree
Hide file tree
Showing 14 changed files with 893 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cyclonedx/model/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) OWASP Foundation. All Rights Reserved.
from enum import Enum
from typing import Optional, Union, Iterable, Any
from typing import Any, Iterable, Optional

import serializable
from sortedcontainers import SortedSet

from .._internal.compare import ComparableTuple as _ComparableTuple
from .bom_ref import BomRef
from ..serialization import BomRefHelper
from .bom_ref import BomRef


@serializable.serializable_enum
Expand Down
4 changes: 2 additions & 2 deletions tests/_data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
Swhid,
Swid,
)
from cyclonedx.model.composition import Composition, AggregateType, CompositionReference
from cyclonedx.model.composition import AggregateType, Composition, CompositionReference
from cyclonedx.model.contact import OrganizationalContact, OrganizationalEntity, PostalAddress
from cyclonedx.model.crypto import (
AlgorithmProperties,
Expand Down Expand Up @@ -392,7 +392,7 @@ def get_bom_with_component_setuptools_with_release_notes() -> Bom:
return _make_bom(components=[component])


def get_bom_with_compositions() -> Bom:
def get_bom_with_compositions_migrate() -> Bom:
c1 = get_component_setuptools_simple()
c2 = get_component_toml_with_hashes_with_references()
bom = _make_bom(components=[c1, c2])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.0" version="1">
<components>
<component type="library">
<name>setuptools</name>
<version>50.3.2</version>
<purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
<modified>false</modified>
</component>
<component type="library">
<name>toml</name>
<version>0.10.2</version>
<hashes>
<hash alg="SHA-256">806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b</hash>
</hashes>
<purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
<modified>false</modified>
</component>
</components>
</bom>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.1" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<components>
<component type="library" bom-ref="pkg:pypi/[email protected]?extension=tar.gz">
<name>setuptools</name>
<version>50.3.2</version>
<licenses>
<license>
<id>MIT</id>
</license>
</licenses>
<purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
</component>
<component type="library" bom-ref="pkg:pypi/[email protected]?extension=tar.gz">
<name>toml</name>
<version>0.10.2</version>
<hashes>
<hash alg="SHA-256">806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b</hash>
</hashes>
<purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
<externalReferences>
<reference type="distribution">
<url>https://cyclonedx.org</url>
<comment>No comment</comment>
</reference>
</externalReferences>
</component>
</components>
</bom>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"components": [
{
"author": "Test Author",
"bom-ref": "pkg:pypi/[email protected]?extension=tar.gz",
"licenses": [
{
"license": {
"id": "MIT"
}
}
],
"name": "setuptools",
"purl": "pkg:pypi/[email protected]?extension=tar.gz",
"type": "library",
"version": "50.3.2"
},
{
"bom-ref": "pkg:pypi/[email protected]?extension=tar.gz",
"externalReferences": [
{
"comment": "No comment",
"type": "distribution",
"url": "https://cyclonedx.org"
}
],
"hashes": [
{
"alg": "SHA-256",
"content": "806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"
}
],
"name": "toml",
"purl": "pkg:pypi/[email protected]?extension=tar.gz",
"type": "library",
"version": "0.10.2"
}
],
"dependencies": [
{
"ref": "pkg:pypi/[email protected]?extension=tar.gz"
},
{
"ref": "pkg:pypi/[email protected]?extension=tar.gz"
}
],
"metadata": {
"timestamp": "2023-01-07T13:44:32.312678+00:00",
"tools": [
{
"name": "cyclonedx-python-lib",
"vendor": "CycloneDX",
"version": "TESTING"
}
]
},
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
"version": 1,
"$schema": "http://cyclonedx.org/schema/bom-1.2b.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.2" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<metadata>
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
<tools>
<tool>
<vendor>CycloneDX</vendor>
<name>cyclonedx-python-lib</name>
<version>TESTING</version>
</tool>
</tools>
</metadata>
<components>
<component type="library" bom-ref="pkg:pypi/[email protected]?extension=tar.gz">
<author>Test Author</author>
<name>setuptools</name>
<version>50.3.2</version>
<licenses>
<license>
<id>MIT</id>
</license>
</licenses>
<purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
</component>
<component type="library" bom-ref="pkg:pypi/[email protected]?extension=tar.gz">
<name>toml</name>
<version>0.10.2</version>
<hashes>
<hash alg="SHA-256">806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b</hash>
</hashes>
<purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
<externalReferences>
<reference type="distribution">
<url>https://cyclonedx.org</url>
<comment>No comment</comment>
</reference>
</externalReferences>
</component>
</components>
<dependencies>
<dependency ref="pkg:pypi/[email protected]?extension=tar.gz"/>
<dependency ref="pkg:pypi/[email protected]?extension=tar.gz"/>
</dependencies>
</bom>
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"components": [
{
"author": "Test Author",
"bom-ref": "pkg:pypi/[email protected]?extension=tar.gz",
"licenses": [
{
"license": {
"id": "MIT"
}
}
],
"name": "setuptools",
"purl": "pkg:pypi/[email protected]?extension=tar.gz",
"type": "library",
"version": "50.3.2"
},
{
"bom-ref": "pkg:pypi/[email protected]?extension=tar.gz",
"externalReferences": [
{
"comment": "No comment",
"hashes": [
{
"alg": "SHA-256",
"content": "806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"
}
],
"type": "distribution",
"url": "https://cyclonedx.org"
}
],
"hashes": [
{
"alg": "SHA-256",
"content": "806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"
}
],
"name": "toml",
"purl": "pkg:pypi/[email protected]?extension=tar.gz",
"type": "library",
"version": "0.10.2"
}
],
"dependencies": [
{
"ref": "pkg:pypi/[email protected]?extension=tar.gz"
},
{
"ref": "pkg:pypi/[email protected]?extension=tar.gz"
}
],
"metadata": {
"timestamp": "2023-01-07T13:44:32.312678+00:00",
"tools": [
{
"name": "cyclonedx-python-lib",
"vendor": "CycloneDX",
"version": "TESTING"
}
]
},
"serialNumber": "urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac",
"version": 1,
"$schema": "http://cyclonedx.org/schema/bom-1.3a.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.3"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" ?>
<bom xmlns="http://cyclonedx.org/schema/bom/1.3" serialNumber="urn:uuid:1441d33a-e0fc-45b5-af3b-61ee52a88bac" version="1">
<metadata>
<timestamp>2023-01-07T13:44:32.312678+00:00</timestamp>
<tools>
<tool>
<vendor>CycloneDX</vendor>
<name>cyclonedx-python-lib</name>
<version>TESTING</version>
</tool>
</tools>
</metadata>
<components>
<component type="library" bom-ref="pkg:pypi/[email protected]?extension=tar.gz">
<author>Test Author</author>
<name>setuptools</name>
<version>50.3.2</version>
<licenses>
<license>
<id>MIT</id>
</license>
</licenses>
<purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
</component>
<component type="library" bom-ref="pkg:pypi/[email protected]?extension=tar.gz">
<name>toml</name>
<version>0.10.2</version>
<hashes>
<hash alg="SHA-256">806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b</hash>
</hashes>
<purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
<externalReferences>
<reference type="distribution">
<url>https://cyclonedx.org</url>
<comment>No comment</comment>
<hashes>
<hash alg="SHA-256">806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b</hash>
</hashes>
</reference>
</externalReferences>
</component>
</components>
<dependencies>
<dependency ref="pkg:pypi/[email protected]?extension=tar.gz"/>
<dependency ref="pkg:pypi/[email protected]?extension=tar.gz"/>
</dependencies>
</bom>
Loading

0 comments on commit 69b0519

Please sign in to comment.