MCPcopy Index your code
hub / github.com/cli/cli / TestJSONOutput

Function TestJSONOutput

pkg/cmd/attestation/inspect/inspect_test.go:51–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestJSONOutput(t *testing.T) {
52 testIO, _, out, _ := iostreams.Test()
53 opts := Options{
54 BundlePath: bundlePath,
55 Logger: io.NewHandler(testIO),
56 SigstoreVerifier: verification.NewMockSigstoreVerifier(t),
57 exporter: cmdutil.NewJSONExporter(),
58 }
59 require.Nil(t, runInspect(&opts))
60
61 var target BundleInspectResult
62 err := json.Unmarshal(out.Bytes(), &target)
63
64 assert.Equal(t, "https://github.com/sigstore/sigstore-js", target.InspectedBundles[0].Certificate.SourceRepositoryURI)
65 assert.Equal(t, "https://slsa.dev/provenance/v1", target.InspectedBundles[0].Statement.PredicateType)
66 require.NoError(t, err)
67}

Callers

nothing calls this directly

Calls 6

TestFunction · 0.92
NewHandlerFunction · 0.92
NewMockSigstoreVerifierFunction · 0.92
NewJSONExporterFunction · 0.92
runInspectFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected