tests: check all enum completeness#992
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
🟢 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%) 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.
Documentation build overview
9 files changed ·
|
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>
ed7563b to
4ff6db8
Compare
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>
|
this PR includes not only the intended tests, but also some fixes. |
There was a problem hiding this comment.
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/**/*.pyforEnumsubclasses and asserts a matchingTestEnum*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.
Description
ad a SCA that finds all enums in the
modelfolder, and tests weather a corresponding test case exists.some enums where not tested properly. added the needed tests.
Resolves or fixes issue: #991
AI Tool Disclosure
[e.g. GitHub CoPilot, ChatGPT, JetBrains Junie etc.][e.g. GPT-4.1, Claude Haiku 4.5, Gemini 2.5 Pro etc.][Summarize the key prompts or instructions given to the AI tools]Affirmation