MCPcopy Create free account
hub / github.com/cli/cli / TestFetchImageFailure

Function TestFetchImageFailure

pkg/cmd/attestation/artifact/image_test.go:29–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27}
28
29func TestFetchImageFailure(t *testing.T) {
30 testcase := []struct {
31 name string
32 client oci.Client
33 expectedErr error
34 }{
35 {
36 name: "Fail to authorize with registry",
37 client: oci.AuthFailClient{},
38 expectedErr: oci.ErrRegistryAuthz,
39 },
40 {
41 name: "Fail to fetch image due to denial",
42 client: oci.DeniedClient{},
43 expectedErr: oci.ErrDenied,
44 },
45 }
46
47 for _, tc := range testcase {
48 url := "example.com/repo:tag"
49 _, err := digestContainerImageArtifact(url, tc.client)
50 require.ErrorIs(t, err, tc.expectedErr)
51 }
52}

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected