Skip to content

Commit fe4493b

Browse files
committed
wip
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 15e350a commit fe4493b

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

cyclonedx/model/vulnerability.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,9 @@ def justification(self, justification: Optional[str]) -> None:
847847

848848
def __comparable_tuple(self) -> _ComparableTuple:
849849
return _ComparableTuple((
850-
self.source, self.score or 0, self.severity, self.method, self.vector, self.justification
850+
self.severity, self.score or 0,
851+
self.source, self.method, self.vector,
852+
self.justification
851853
))
852854

853855
def __eq__(self, other: object) -> bool:
@@ -864,7 +866,9 @@ def __hash__(self) -> int:
864866
return hash(self.__comparable_tuple())
865867

866868
def __repr__(self) -> str:
867-
return f'<VulnerabilityRating score={self.score}, source={self.source}>'
869+
return f'<VulnerabilityRating severity={self.severity} score={self.score}, ' \
870+
f'source={self.source} method={self.method} vector={self.vector}' \
871+
f'justification={self.justification}>'
868872

869873

870874
@serializable.serializable_class

tests/test_model_component.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ def test_sort(self) -> None:
351351
class TestModelAttachedText(TestCase):
352352

353353
def test_sort(self) -> None:
354-
# expected sort order: (content_type, content, encoding)
355-
expected_order = [0, 4, 2, 1, 3]
354+
# expected sort order: (content_type, encoding, content)
355+
expected_order = [0, 1, 2, 4, 3,]
356356
text = [
357357
AttachedText(content='a', content_type='a', encoding=Encoding.BASE_64),
358358
AttachedText(content='a', content_type='b', encoding=Encoding.BASE_64),

tests/test_model_vulnerability.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ def test_sort(self) -> None:
298298
]
299299
sorted_refs = sorted(refs)
300300
expected_refs = reorder(refs, expected_order)
301+
self.maxDiff = None # gimme all diff on error
301302
self.assertListEqual(sorted_refs, expected_refs)
302303

303304

0 commit comments

Comments
 (0)