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

Function TestGetImageDigest_ReferenceFail

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

Source from the content-addressed store, hash-verified

37}
38
39func TestGetImageDigest_ReferenceFail(t *testing.T) {
40 c := LiveClient{
41 parseReference: func(string, ...name.Option) (name.Reference, error) {
42 return nil, fmt.Errorf("failed to parse reference")
43 },
44 get: func(name.Reference, ...remote.Option) (*remote.Descriptor, error) {
45 return nil, nil
46 },
47 }
48
49 digest, nameRef, err := c.GetImageDigest("test")
50 require.Error(t, err)
51 require.Nil(t, digest)
52 require.Nil(t, nameRef)
53}
54
55func TestGetImageDigest_AuthFail(t *testing.T) {
56 c := LiveClient{

Callers

nothing calls this directly

Calls 3

GetImageDigestMethod · 0.95
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected