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

Function TestGetImageDigest_AuthFail

pkg/cmd/attestation/artifact/oci/client_test.go:55–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestGetImageDigest_AuthFail(t *testing.T) {
56 c := LiveClient{
57 parseReference: func(string, ...name.Option) (name.Reference, error) {
58 return name.Tag{}, nil
59 },
60 get: func(name.Reference, ...remote.Option) (*remote.Descriptor, error) {
61 return nil, &transport.Error{Errors: []transport.Diagnostic{{Code: transport.UnauthorizedErrorCode}}}
62 },
63 }
64
65 digest, nameRef, err := c.GetImageDigest("test")
66 require.Error(t, err)
67 require.ErrorIs(t, err, ErrRegistryAuthz)
68 require.Nil(t, digest)
69 require.Nil(t, nameRef)
70}
71
72func TestGetImageDigest_Denied(t *testing.T) {
73 c := LiveClient{

Callers

nothing calls this directly

Calls 2

GetImageDigestMethod · 0.95
ErrorMethod · 0.45

Tested by

no test coverage detected