Skip to content
Closed
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
5 changes: 3 additions & 2 deletions cyclonedx/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@ class ExternalReferenceType(str, Enum):
POAM = 'poam' # Only supported in >= 1.5
QUALITY_METRICS = 'quality-metrics' # Only supported in >= 1.5
RELEASE_NOTES = 'release-notes' # Only supported in >= 1.4
RFC_9166 = 'rfc-9116' # Only supported in >= 1.6
RFC_9116 = 'rfc-9116' # Only supported in >= 1.6
RFC_9166 = 'rfc-9116' # deprecated alias of `RFC_9116` - kept for backward compatibility, see #1074
RISK_ASSESSMENT = 'risk-assessment' # Only supported in >= 1.5
RUNTIME_ANALYSIS_REPORT = 'runtime-analysis-report' # Only supported in >= 1.5
SECURITY_CONTACT = 'security-contact' # Only supported in >= 1.5
Expand Down Expand Up @@ -586,7 +587,7 @@ class _ExternalReferenceSerializationHelper(serializable.helpers.BaseHelper):
ExternalReferenceType.SOURCE_DISTRIBUTION,
ExternalReferenceType.ELECTRONIC_SIGNATURE,
ExternalReferenceType.DIGITAL_SIGNATURE,
ExternalReferenceType.RFC_9166,
ExternalReferenceType.RFC_9116,
}
__CASES[SchemaVersion1Dot7] = __CASES[SchemaVersion1Dot6] | {
ExternalReferenceType.CITATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="other">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="other">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "other",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "other",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="other">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="other">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "other",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "other",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="other">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="other">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "other",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "other",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="other">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="other">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "other",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "risk-assessment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="other">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="risk-assessment">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "rfc-9116",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "risk-assessment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="rfc-9116">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="risk-assessment">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
},
{
"type": "rfc-9116",
"url": "tests/RFC_9166"
"url": "tests/RFC_9116"
},
{
"type": "risk-assessment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<url>tests/RELEASE_NOTES</url>
</reference>
<reference type="rfc-9116">
<url>tests/RFC_9166</url>
<url>tests/RFC_9116</url>
</reference>
<reference type="risk-assessment">
<url>tests/RISK_ASSESSMENT</url>
Expand Down
15 changes: 15 additions & 0 deletions tests/test_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,21 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any,
])
super()._test_cases_render(bom, of, sv)

def test_rfc_9116_is_spelled_correctly(self) -> None:
self.assertEqual('rfc-9116', ExternalReferenceType.RFC_9116.value)
self.assertEqual('RFC_9116', ExternalReferenceType.RFC_9116.name)
self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType('rfc-9116'))

def test_rfc_9166_is_a_deprecated_alias(self) -> None:
# the member was misspelled in earlier versions - it stays available as an alias
self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType.RFC_9166)

def test_rfc_members_follow_upper_snake_case_naming(self) -> None:
# `_test_knows_value()` only proves a value is known, not that its member name is spelled right
for member in ExternalReferenceType:
if member.value.startswith('rfc-'):
self.assertEqual(member.value.upper().replace('-', '_'), member.name)


@ddt
class TestEnumHashAlgorithm(_EnumTestCase):
Expand Down