print IDs instead of key itself

Signed-off-by: Riyaz Faizullabhoy <riyaz.faizullabhoy@docker.com>
This commit is contained in:
Riyaz Faizullabhoy 2016-02-24 11:18:33 -08:00
parent 6d76ce10ba
commit 596a362a36
2 changed files with 6 additions and 1 deletions

View File

@ -270,7 +270,7 @@ func (d *delegationCommander) delegationAdd(cmd *cobra.Command, args []string) e
cmd.Println("") cmd.Println("")
addingItems := "" addingItems := ""
if len(pubKeyIDs) > 0 { if len(pubKeyIDs) > 0 {
addingItems = addingItems + fmt.Sprintf("with keys %s, ", pubKeys) addingItems = addingItems + fmt.Sprintf("with keys %s, ", pubKeyIDs)
} }
if d.paths != nil || d.allPaths { if d.paths != nil || d.allPaths {
addingItems = addingItems + fmt.Sprintf("with paths [%s], ", prettyPrintPaths(d.paths)) addingItems = addingItems + fmt.Sprintf("with paths [%s], ", prettyPrintPaths(d.paths))

View File

@ -203,6 +203,7 @@ func TestClientDelegationsInteraction(t *testing.T) {
output, err = runCommand(t, tempDir, "delegation", "add", "gun", "targets/delegation", tempFile.Name()) output, err = runCommand(t, tempDir, "delegation", "add", "gun", "targets/delegation", tempFile.Name())
assert.NoError(t, err) assert.NoError(t, err)
assert.Contains(t, output, "Addition of delegation role") assert.Contains(t, output, "Addition of delegation role")
assert.Contains(t, output, keyID)
assert.NotContains(t, output, "path") assert.NotContains(t, output, "path")
// check status - see delegation // check status - see delegation
@ -274,6 +275,7 @@ func TestClientDelegationsInteraction(t *testing.T) {
output, err = runCommand(t, tempDir, "delegation", "add", "gun", "targets/delegation", tempFile2.Name(), "--paths", "path") output, err = runCommand(t, tempDir, "delegation", "add", "gun", "targets/delegation", tempFile2.Name(), "--paths", "path")
assert.NoError(t, err) assert.NoError(t, err)
assert.Contains(t, output, "Addition of delegation role") assert.Contains(t, output, "Addition of delegation role")
assert.Contains(t, output, keyID2)
// publish repo // publish repo
_, err = runCommand(t, tempDir, "-s", server.URL, "publish", "gun") _, err = runCommand(t, tempDir, "-s", server.URL, "publish", "gun")
@ -320,6 +322,8 @@ func TestClientDelegationsInteraction(t *testing.T) {
output, err = runCommand(t, tempDir, "delegation", "add", "gun", "targets/delegation", tempFile.Name(), tempFile2.Name(), "--paths", "path1,path2") output, err = runCommand(t, tempDir, "delegation", "add", "gun", "targets/delegation", tempFile.Name(), tempFile2.Name(), "--paths", "path1,path2")
assert.NoError(t, err) assert.NoError(t, err)
assert.Contains(t, output, "Addition of delegation role") assert.Contains(t, output, "Addition of delegation role")
assert.Contains(t, output, keyID)
assert.Contains(t, output, keyID2)
// publish repo // publish repo
_, err = runCommand(t, tempDir, "-s", server.URL, "publish", "gun") _, err = runCommand(t, tempDir, "-s", server.URL, "publish", "gun")
@ -600,6 +604,7 @@ func TestClientDelegationsPublishing(t *testing.T) {
output, err = runCommand(t, tempDir, "delegation", "add", "gun", "targets/releases", tempFile.Name(), "--paths", "\"\"") output, err = runCommand(t, tempDir, "delegation", "add", "gun", "targets/releases", tempFile.Name(), "--paths", "\"\"")
assert.NoError(t, err) assert.NoError(t, err)
assert.Contains(t, output, "Addition of delegation role") assert.Contains(t, output, "Addition of delegation role")
assert.Contains(t, output, canonicalKeyID)
// publish repo // publish repo
_, err = runCommand(t, tempDir, "-s", server.URL, "publish", "gun") _, err = runCommand(t, tempDir, "-s", server.URL, "publish", "gun")