MCPcopy
hub / github.com/cli/cli / TestJSONOutput

Function TestJSONOutput

pkg/cmd/attestation/verify/verify_test.go:350–371  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

348}
349
350func TestJSONOutput(t *testing.T) {
351 testIO, _, out, _ := iostreams.Test()
352 opts := Options{
353 ArtifactPath: artifactPath,
354 BundlePath: bundlePath,
355 DigestAlgorithm: "sha512",
356 APIClient: api.NewTestClient(),
357 Logger: io.NewHandler(testIO),
358 OCIClient: oci.MockClient{},
359 OIDCIssuer: verification.GitHubOIDCIssuer,
360 Owner: "sigstore",
361 PredicateType: verification.SLSAPredicateV1,
362 SANRegex: "^https://github.com/sigstore/",
363 SigstoreVerifier: verification.NewMockSigstoreVerifier(t),
364 exporter: cmdutil.NewJSONExporter(),
365 }
366 require.NoError(t, runVerify(&opts))
367
368 var target []*verification.AttestationProcessingResult
369 err := json.Unmarshal(out.Bytes(), &target)
370 require.NoError(t, err)
371}
372
373func TestRunVerify(t *testing.T) {
374 logger := io.NewTestHandler()

Callers

nothing calls this directly

Calls 6

TestFunction · 0.92
NewTestClientFunction · 0.92
NewHandlerFunction · 0.92
NewMockSigstoreVerifierFunction · 0.92
NewJSONExporterFunction · 0.92
runVerifyFunction · 0.85

Tested by

no test coverage detected