Skip to content

test(attestation): add parser coverage for witness formats#37

Open
IITI-tushar wants to merge 1 commit intoSBOMit:masterfrom
IITI-tushar:test-attestation-parser-coverage
Open

test(attestation): add parser coverage for witness formats#37
IITI-tushar wants to merge 1 commit intoSBOMit:masterfrom
IITI-tushar:test-attestation-parser-coverage

Conversation

@IITI-tushar
Copy link
Copy Markdown

Resolves: #36
This pull request adds a comprehensive test suite for the attestation parsing logic. The new tests cover a variety of scenarios for both data and file parsing, including different attestation types, DSSE envelope handling, error cases, and normalization functions. This improves confidence in the correctness and robustness of the attestation parser.

New test coverage for attestation parsing:

  • Adds unit tests for ParseWitnessData to cover direct statements, DSSE envelopes, type filtering, empty inputs, malformed JSON, missing payloads, and multiple attestations of the same type.
  • Adds tests for ParseWitnessFile, including file-not-found errors, valid file parsing, and integration with a real sample attestation file.

Attestation type normalization and canonicalization:

  • Adds tests for canonicalAttestationType and normalizeAttestationType functions, ensuring correct handling of URI-style, shorthand, aliases, and case-insensitive inputs.

Test utilities and helpers:

  • Implements helper functions (buildInTotoStatement, buildDSSEEnvelope) to generate test data for in-toto statements and DSSE envelopes, facilitating robust and maintainable tests.

Signed-off-by: Tushar Saxena <019saxenatushar@gmail.com>
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.

Add unit tests for the attestation parser

1 participant