(t *testing.T)
| 66 | } |
| 67 | |
| 68 | func 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 | |
| 86 | func TestSignerAddCommandBadKeyPath(t *testing.T) { |
| 87 | config.SetDir(t.TempDir()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…