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

Function TestSignerAddCommandBadKeyPath

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

Source from the content-addressed store, hash-verified

84}
85
86func TestSignerAddCommandBadKeyPath(t *testing.T) {
87 config.SetDir(t.TempDir())
88
89 cli := test.NewFakeCli(&fakeClient{})
90 cli.SetNotaryClient(notaryfake.GetEmptyTargetsNotaryRepository)
91 cmd := newSignerAddCommand(cli)
92 cmd.SetArgs([]string{"--key", "/path/to/key.pem", "alice", "alpine"})
93
94 cmd.SetOut(io.Discard)
95 cmd.SetErr(io.Discard)
96 expectedError := "unable to read public key from file: open /path/to/key.pem: no such file or directory"
97 if runtime.GOOS == "windows" {
98 expectedError = "unable to read public key from file: open /path/to/key.pem: The system cannot find the path specified."
99 }
100 assert.Error(t, cmd.Execute(), expectedError)
101}
102
103func TestSignerAddCommandInvalidRepoName(t *testing.T) {
104 config.SetDir(t.TempDir())

Callers

nothing calls this directly

Calls 6

SetNotaryClientMethod · 0.95
newSignerAddCommandFunction · 0.85
SetArgsMethod · 0.80
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…