Skip to content

tests(generate-cve-json): cover normalise_severity, to_html, build_descriptions, build_cna_container, emit_json#235

Merged
potiuk merged 4 commits into
apache:mainfrom
justinmclean:cve-json-test-coverage
May 20, 2026
Merged

tests(generate-cve-json): cover normalise_severity, to_html, build_descriptions, build_cna_container, emit_json#235
potiuk merged 4 commits into
apache:mainfrom
justinmclean:cve-json-test-coverage

Conversation

@justinmclean
Copy link
Copy Markdown
Member

35 new tests filling the remaining coverage gaps in test_generate_cve_json.py.

Changes

tests/test_generate_cve_json.py — new test cases covering:

  • normalise_severity — known values lowercased, unknown values stripped, mixed-case handling
  • to_html — HTML escaping of <, >, &; newline conversion (\n\n<br><br>, \n<br>); Windows line-ending normalisation
  • build_descriptions — empty input, lang/value/supportingMedia shape, HTML escaping in media vs plain text in value field
  • build_cna_container — all required keys present; title/org-id/discovery wiring; affected/descriptions/metrics/problemTypes/credits/references delegation; advisory_urls and product_overrides forwarding; empty severity/cwe produce empty lists; mailing-list URL excluded
  • emit_json — returns sorted indented JSON, file write with parent-dir creation, trailing newline, return value matches file content, non-ASCII preserved

claude and others added 4 commits May 19, 2026 09:58
…scriptions, build_cna_container, emit_json

35 new tests filling the remaining gaps in test_generate_cve_json.py:

- normalise_severity: known values lowercased, unknown values stripped,
  mixed-case handling
- to_html: HTML escaping of <, >, &, newline conversion (\n\n → <br><br>,
  \n → <br>), Windows line-ending normalisation
- build_descriptions: empty input, lang/value/supportingMedia shape,
  HTML escaping in media vs plain text in value field
- build_cna_container: all required keys present, title/org-id/discovery
  wiring, affected/descriptions/metrics/problemTypes/credits/references
  delegation, advisory_urls and product_overrides forwarding, empty
  severity/cwe produce empty lists, mailing-list URL excluded
- emit_json: returns sorted indented JSON, file write with parent-dir
  creation, trailing newline, return value matches file content,
  non-ASCII preserved

https://claude.ai/code/session_01WEx58ofmTyCe2YhCppV3qN
@justinmclean justinmclean self-assigned this May 20, 2026
@potiuk potiuk merged commit 4798b75 into apache:main May 20, 2026
13 checks passed
@potiuk
Copy link
Copy Markdown
Member

potiuk commented May 20, 2026

the more determinstic tests -> the better

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.

3 participants