mirror of https://github.com/docker/cli.git
Fix tests and nit
Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>
This commit is contained in:
parent
448082f333
commit
5ebb7a65ab
|
@ -46,10 +46,8 @@ func removeSigner(cli command.Cli, options signerRemoveOptions) error {
|
||||||
if didRemove, err := removeSingleSigner(cli, repo, options.signer, options.forceYes); err != nil {
|
if didRemove, err := removeSingleSigner(cli, repo, options.signer, options.forceYes); err != nil {
|
||||||
fmt.Fprintln(cli.Err(), err.Error()+"\n")
|
fmt.Fprintln(cli.Err(), err.Error()+"\n")
|
||||||
errRepos = append(errRepos, repo)
|
errRepos = append(errRepos, repo)
|
||||||
} else {
|
} else if didRemove {
|
||||||
if didRemove {
|
fmt.Fprintf(cli.Out(), "Successfully removed %s from %s\n\n", options.signer, repo)
|
||||||
fmt.Fprintf(cli.Out(), "Successfully removed %s from %s\n\n", options.signer, repo)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(errRepos) > 0 {
|
if len(errRepos) > 0 {
|
||||||
|
|
|
@ -71,10 +71,13 @@ func TestTrustSignerRemoveErrors(t *testing.T) {
|
||||||
func TestRemoveSingleSigner(t *testing.T) {
|
func TestRemoveSingleSigner(t *testing.T) {
|
||||||
cli := test.NewFakeCli(&fakeClient{})
|
cli := test.NewFakeCli(&fakeClient{})
|
||||||
cli.SetNotaryClient(notaryfake.GetLoadedNotaryRepository)
|
cli.SetNotaryClient(notaryfake.GetLoadedNotaryRepository)
|
||||||
_, err := removeSingleSigner(cli, "signed-repo", "test", true)
|
didRemove, err := removeSingleSigner(cli, "signed-repo", "test", true)
|
||||||
assert.Error(t, err, "No signer test for repository signed-repo")
|
assert.Error(t, err, "No signer test for repository signed-repo")
|
||||||
|
assert.Equal(t, didRemove, false, "No signer should be removed")
|
||||||
|
|
||||||
_, err = removeSingleSigner(cli, "signed-repo", "releases", true)
|
_, err = removeSingleSigner(cli, "signed-repo", "releases", true)
|
||||||
assert.Error(t, err, "releases is a reserved keyword and cannot be removed")
|
assert.Error(t, err, "releases is a reserved keyword and cannot be removed")
|
||||||
|
assert.Equal(t, didRemove, false, "No signer should be removed")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRemoveMultipleSigners(t *testing.T) {
|
func TestRemoveMultipleSigners(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue