MCPcopy Create free account
hub / github.com/docker/cli / TestSignerAddCommandNoTargetsKey

Function TestSignerAddCommandNoTargetsKey

cmd/docker-trust/trust/signer_add_test.go:68–84  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func TestSignerAddCommandNoTargetsKey(t *testing.T) {
69 config.SetDir(t.TempDir())
70
71 tmpDir := t.TempDir()
72 tmpFile, err := os.CreateTemp(tmpDir, "pemfile")
73 assert.NilError(t, err)
74 assert.Check(t, tmpFile.Close())
75
76 cli := test.NewFakeCli(&fakeClient{})
77 cli.SetNotaryClient(notaryfake.GetEmptyTargetsNotaryRepository)
78 cmd := newSignerAddCommand(cli)
79 cmd.SetArgs([]string{"--key", tmpFile.Name(), "alice", "alpine", "linuxkit/alpine"})
80
81 cmd.SetOut(io.Discard)
82 cmd.SetErr(io.Discard)
83 assert.Error(t, cmd.Execute(), fmt.Sprintf("could not parse public key from file: %s: no valid public key found", tmpFile.Name()))
84}
85
86func TestSignerAddCommandBadKeyPath(t *testing.T) {
87 config.SetDir(t.TempDir())

Callers

nothing calls this directly

Calls 8

SetNotaryClientMethod · 0.95
newSignerAddCommandFunction · 0.85
SetArgsMethod · 0.80
CloseMethod · 0.45
NameMethod · 0.45
SetOutMethod · 0.45
SetErrMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…