(t *testing.T)
| 53 | } |
| 54 | |
| 55 | func 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 | |
| 72 | func TestGetImageDigest_Denied(t *testing.T) { |
| 73 | c := LiveClient{ |
nothing calls this directly
no test coverage detected