(t *testing.T)
| 24 | var bundlePath = test.NormalizeRelativePath("../test/data/sigstore-js-2.1.0-bundle.json") |
| 25 | |
| 26 | func TestRunInspect(t *testing.T) { |
| 27 | opts := Options{ |
| 28 | BundlePath: bundlePath, |
| 29 | Logger: io.NewTestHandler(), |
| 30 | OCIClient: oci.MockClient{}, |
| 31 | SigstoreVerifier: verification.NewMockSigstoreVerifier(t), |
| 32 | } |
| 33 | |
| 34 | t.Run("with valid bundle and default output", func(t *testing.T) { |
| 35 | testIO, _, out, _ := iostreams.Test() |
| 36 | opts.Logger = io.NewHandler(testIO) |
| 37 | |
| 38 | require.Nil(t, runInspect(&opts)) |
| 39 | outputStr := string(out.Bytes()[:]) |
| 40 | |
| 41 | assert.Regexp(t, "PredicateType:......... https://slsa.dev/provenance/v1", outputStr) |
| 42 | }) |
| 43 | |
| 44 | t.Run("with missing bundle path", func(t *testing.T) { |
| 45 | customOpts := opts |
| 46 | customOpts.BundlePath = test.NormalizeRelativePath("../test/data/non-existent-sigstoreBundle.json") |
| 47 | require.Error(t, runInspect(&customOpts)) |
| 48 | }) |
| 49 | } |
| 50 | |
| 51 | func TestJSONOutput(t *testing.T) { |
| 52 | testIO, _, out, _ := iostreams.Test() |
nothing calls this directly
no test coverage detected