(t *testing.T)
| 84 | } |
| 85 | |
| 86 | func 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 | |
| 103 | func TestSignerAddCommandInvalidRepoName(t *testing.T) { |
| 104 | config.SetDir(t.TempDir()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…