Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support services data object #683

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
change dataclassification to data in enum test
Signed-off-by: luca.morgese@tno.nl <luca.morgese@tno.nl>
  • Loading branch information
lucamrgs committed Sep 23, 2024
commit 58a56345d8b67c8d97664a0dd1a4d2897ca8026a
6 changes: 3 additions & 3 deletions cyclonedx/model/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(
endpoints: Optional[Iterable[XsUri]] = None,
authenticated: Optional[bool] = None,
x_trust_boundary: Optional[bool] = None,
data: Optional[Iterable[DataClassification]] = None,
data: Optional[Iterable['Data']] = None,
licenses: Optional[Iterable[License]] = None,
external_references: Optional[Iterable[ExternalReference]] = None,
properties: Optional[Iterable[Property]] = None,
Expand Down Expand Up @@ -626,12 +626,12 @@ def destination(self, destination: Optional[Iterable[Union[BomRef, XsUri]]]) ->
self._destination = destination

def __eq__(self, other: object) -> bool:
if isinstance(other, DataClassification):
if isinstance(other, Data):
return hash(other) == hash(self)
return False

def __lt__(self, other: object) -> bool:
if isinstance(other, DataClassification):
if isinstance(other, Data):
return _ComparableTuple((
self.flow, self.classification
)) < _ComparableTuple((
Expand Down
5 changes: 3 additions & 2 deletions tests/test_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from cyclonedx.model.component import Component, Patch, Pedigree
from cyclonedx.model.issue import IssueType
from cyclonedx.model.license import DisjunctiveLicense
from cyclonedx.model.service import DataClassification, Service
from cyclonedx.model.service import Data, Service
from cyclonedx.model.vulnerability import (
BomTarget,
BomTargetVersionRange,
Expand Down Expand Up @@ -168,7 +168,8 @@ def test_knows_value(self, value: str) -> None:
@patch('cyclonedx.model.ThisTool._version', 'TESTING')
def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, **__: Any) -> None:
bom = _make_bom(services=[Service(name='dummy', bom_ref='dummy', data=(
DataClassification(flow=df, classification=df.name)
Data(flow=df, classification=df.name)
# DataClassification(flow=df, classification=df.name)
for df in DataFlow
))])
super()._test_cases_render(bom, of, sv)
Expand Down