Skip to content

tests: check all enum completeness#992

Merged
jkowalleck merged 43 commits into
mainfrom
tests/check-all-enum-completeness
Jun 17, 2026
Merged

tests: check all enum completeness#992
jkowalleck merged 43 commits into
mainfrom
tests/check-all-enum-completeness

Conversation

@jkowalleck

@jkowalleck jkowalleck commented Jun 8, 2026

Copy link
Copy Markdown
Member

Description

  • make sure all enums are tested for completeness:
    ad a SCA that finds all enums in the model folder, and tests weather a corresponding test case exists.
  • added test cases for all enums
    some enums where not tested properly. added the needed tests.

Resolves or fixes issue: #991

AI Tool Disclosure

  • My contribution does not include any AI-generated content
  • My contribution includes AI-generated content, as disclosed below:
    • AI Tools: [e.g. GitHub CoPilot, ChatGPT, JetBrains Junie etc.]
    • LLMs and versions: [e.g. GPT-4.1, Claude Haiku 4.5, Gemini 2.5 Pro etc.]
    • Prompts: [Summarize the key prompts or instructions given to the AI tools]

Affirmation

@jkowalleck jkowalleck requested a review from a team as a code owner June 8, 2026 09:32
@codacy-production

codacy-production Bot commented Jun 8, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.00% coverage variation

Metric Results
Coverage variation +0.00% coverage variation
Diff coverage 100.00% diff coverage (80.00%)

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (bc97e1c) 6124 5774 94.28%
Head commit (857b885) 6124 (+0) 5774 (+0) 94.28% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#992) 1 1 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@read-the-docs-community

read-the-docs-community Bot commented Jun 8, 2026

Copy link
Copy Markdown

Comment thread tests/__init__.py Outdated
@jkowalleck jkowalleck marked this pull request as draft June 9, 2026 13:14
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
@jkowalleck jkowalleck force-pushed the tests/check-all-enum-completeness branch from ed7563b to 4ff6db8 Compare June 15, 2026 08:58
Comment thread tests/test_enums.py Fixed
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Comment thread cyclonedx/model/crypto.py
Comment thread cyclonedx/model/crypto.py Outdated
Comment thread cyclonedx/model/crypto.py Outdated
Comment thread cyclonedx/model/crypto.py Outdated
Comment thread cyclonedx/model/crypto.py
Comment thread cyclonedx/model/crypto.py
Comment thread cyclonedx/model/crypto.py
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
@jkowalleck

Copy link
Copy Markdown
Member Author

this PR includes not only the intended tests, but also some fixes.
will write tickets and extra PRs for them.

Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Comment thread cyclonedx/model/crypto.py
Comment thread cyclonedx/model/crypto.py
Comment thread cyclonedx/model/crypto.py
Comment thread cyclonedx/model/crypto.py
Comment thread cyclonedx/model/crypto.py
Comment thread cyclonedx/model/crypto.py
@jkowalleck jkowalleck requested a review from Copilot June 17, 2026 10:20
@jkowalleck jkowalleck changed the title [WIP] tests: check all enum completeness tests: check all enum completeness Jun 17, 2026
@jkowalleck jkowalleck marked this pull request as ready for review June 17, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a “meta-test” to ensure every Enum defined under cyclonedx/model/**/*.py has a corresponding enum test case, and expands the enum test suite by adding snapshot fixtures for previously untested model enums (notably crypto- and evidence-related enums) across supported spec versions.

Changes:

  • Add a completeness test that scans cyclonedx/model/**/*.py for Enum subclasses and asserts a matching TestEnum* test exists.
  • Add enum test cases and snapshot fixtures for additional model enums (including many CycloneDX 1.6/1.7 crypto enums and evidence/license enums).
  • Minor refactors/formatting in test helpers and enum declarations to support the new test coverage.

Reviewed changes

Copilot reviewed 89 out of 89 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cyclonedx/model/crypto.py Minor enum formatting/comments aligned with expanded enum test coverage.
tests/init.py Adds project root/lib/model directory constants used by enum completeness scanning.
tests/test_enums.py Adds/extends enum test cases and introduces the meta “all enums have tests” completeness check.
tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.6.xml.bin New snapshot fixture for RelatedCryptoMaterialType rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.7.xml.bin New snapshot fixture for RelatedCryptoMaterialType rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_RelatedCryptoMaterialType-1.7.json.bin New snapshot fixture for RelatedCryptoMaterialType rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.6.xml.bin New snapshot fixture for RelatedCryptoMaterialState rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.6.json.bin New snapshot fixture for RelatedCryptoMaterialState rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.7.xml.bin New snapshot fixture for RelatedCryptoMaterialState rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_RelatedCryptoMaterialState-1.7.json.bin New snapshot fixture for RelatedCryptoMaterialState rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.xml.bin New snapshot fixture for ProtocolPropertiesType rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_ProtocolPropertiesType-1.6.json.bin New snapshot fixture for ProtocolPropertiesType rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin New snapshot fixture for ProtocolPropertiesType rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin New snapshot fixture for ProtocolPropertiesType rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.0.xml.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.0 XML).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.1.xml.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.1 XML).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.2.xml.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.2 XML).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.2.json.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.2 JSON).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.3.xml.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.3 XML).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.3.json.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.3 JSON).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.4.xml.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.4 XML).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.4.json.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.4 JSON).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.5.xml.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.5 XML).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.5.json.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.5 JSON).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.6.xml.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.6.json.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.7.xml.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_LicenseAcknowledgement-1.7.json.bin New snapshot fixture for LicenseAcknowledgement rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_IdentityField-1.0.xml.bin New snapshot fixture for IdentityField rendering (CDX 1.0 XML).
tests/_data/snapshots/enum_IdentityField-1.1.xml.bin New snapshot fixture for IdentityField rendering (CDX 1.1 XML).
tests/_data/snapshots/enum_IdentityField-1.2.xml.bin New snapshot fixture for IdentityField rendering (CDX 1.2 XML).
tests/_data/snapshots/enum_IdentityField-1.2.json.bin New snapshot fixture for IdentityField rendering (CDX 1.2 JSON).
tests/_data/snapshots/enum_IdentityField-1.3.xml.bin New snapshot fixture for IdentityField rendering (CDX 1.3 XML).
tests/_data/snapshots/enum_IdentityField-1.3.json.bin New snapshot fixture for IdentityField rendering (CDX 1.3 JSON).
tests/_data/snapshots/enum_IdentityField-1.4.xml.bin New snapshot fixture for IdentityField rendering (CDX 1.4 XML).
tests/_data/snapshots/enum_IdentityField-1.4.json.bin New snapshot fixture for IdentityField rendering (CDX 1.4 JSON).
tests/_data/snapshots/enum_IdentityField-1.5.xml.bin New snapshot fixture for IdentityField rendering (CDX 1.5 XML).
tests/_data/snapshots/enum_IdentityField-1.5.json.bin New snapshot fixture for IdentityField rendering (CDX 1.5 JSON).
tests/_data/snapshots/enum_IdentityField-1.6.xml.bin New snapshot fixture for IdentityField rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_IdentityField-1.6.json.bin New snapshot fixture for IdentityField rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_IdentityField-1.7.xml.bin New snapshot fixture for IdentityField rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_IdentityField-1.7.json.bin New snapshot fixture for IdentityField rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_CryptoPrimitive-1.6.xml.bin New snapshot fixture for CryptoPrimitive rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_CryptoPrimitive-1.6.json.bin New snapshot fixture for CryptoPrimitive rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_CryptoPrimitive-1.7.xml.bin New snapshot fixture for CryptoPrimitive rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_CryptoPrimitive-1.7.json.bin New snapshot fixture for CryptoPrimitive rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_CryptoPadding-1.6.xml.bin New snapshot fixture for CryptoPadding rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_CryptoPadding-1.6.json.bin New snapshot fixture for CryptoPadding rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_CryptoPadding-1.7.xml.bin New snapshot fixture for CryptoPadding rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_CryptoPadding-1.7.json.bin New snapshot fixture for CryptoPadding rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_CryptoMode-1.6.xml.bin New snapshot fixture for CryptoMode rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_CryptoMode-1.6.json.bin New snapshot fixture for CryptoMode rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_CryptoMode-1.7.xml.bin New snapshot fixture for CryptoMode rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_CryptoMode-1.7.json.bin New snapshot fixture for CryptoMode rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_CryptoImplementationPlatform-1.6.xml.bin New snapshot fixture for CryptoImplementationPlatform rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_CryptoImplementationPlatform-1.6.json.bin New snapshot fixture for CryptoImplementationPlatform rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_CryptoImplementationPlatform-1.7.xml.bin New snapshot fixture for CryptoImplementationPlatform rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_CryptoImplementationPlatform-1.7.json.bin New snapshot fixture for CryptoImplementationPlatform rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_CryptoFunction-1.6.xml.bin New snapshot fixture for CryptoFunction rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_CryptoFunction-1.6.json.bin New snapshot fixture for CryptoFunction rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_CryptoFunction-1.7.xml.bin New snapshot fixture for CryptoFunction rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_CryptoFunction-1.7.json.bin New snapshot fixture for CryptoFunction rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.6.xml.bin New snapshot fixture for CryptoExecutionEnvironment rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.6.json.bin New snapshot fixture for CryptoExecutionEnvironment rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.7.xml.bin New snapshot fixture for CryptoExecutionEnvironment rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_CryptoExecutionEnvironment-1.7.json.bin New snapshot fixture for CryptoExecutionEnvironment rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_CryptoAssetType-1.6.xml.bin New snapshot fixture for CryptoAssetType rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_CryptoAssetType-1.6.json.bin New snapshot fixture for CryptoAssetType rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_CryptoAssetType-1.7.xml.bin New snapshot fixture for CryptoAssetType rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_CryptoAssetType-1.7.json.bin New snapshot fixture for CryptoAssetType rendering (CDX 1.7 JSON).
tests/_data/snapshots/enum_AnalysisTechnique-1.0.xml.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.0 XML).
tests/_data/snapshots/enum_AnalysisTechnique-1.1.xml.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.1 XML).
tests/_data/snapshots/enum_AnalysisTechnique-1.2.xml.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.2 XML).
tests/_data/snapshots/enum_AnalysisTechnique-1.2.json.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.2 JSON).
tests/_data/snapshots/enum_AnalysisTechnique-1.3.xml.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.3 XML).
tests/_data/snapshots/enum_AnalysisTechnique-1.3.json.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.3 JSON).
tests/_data/snapshots/enum_AnalysisTechnique-1.4.xml.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.4 XML).
tests/_data/snapshots/enum_AnalysisTechnique-1.4.json.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.4 JSON).
tests/_data/snapshots/enum_AnalysisTechnique-1.5.xml.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.5 XML).
tests/_data/snapshots/enum_AnalysisTechnique-1.5.json.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.5 JSON).
tests/_data/snapshots/enum_AnalysisTechnique-1.6.xml.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.6 XML).
tests/_data/snapshots/enum_AnalysisTechnique-1.6.json.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.6 JSON).
tests/_data/snapshots/enum_AnalysisTechnique-1.7.xml.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.7 XML).
tests/_data/snapshots/enum_AnalysisTechnique-1.7.json.bin New snapshot fixture for AnalysisTechnique rendering (CDX 1.7 JSON).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.xml.bin
Comment thread tests/_data/snapshots/enum_ProtocolPropertiesType-1.7.json.bin
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 89 out of 89 changed files in this pull request and generated 1 comment.

Comment thread tests/test_enums.py
@jkowalleck jkowalleck merged commit ebb168a into main Jun 17, 2026
54 checks passed
@jkowalleck jkowalleck deleted the tests/check-all-enum-completeness branch June 17, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants