Skip to content

Commit

Permalink
Merge branch 'api-key-prettyprint' into 'develop'
Browse files Browse the repository at this point in the history
fix duplicated "apikey." prefix when creating an API key

See merge request open-source/bytemark-client!304
  • Loading branch information
Hannah Pirie committed Jan 9, 2019
2 parents ced6ab6 + 53a27fa commit 0f5252f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/bytemark/commands/add/api_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestAddApiKey(t *testing.T) {
Name: "all defaults",
Args: "test-api-key",
OutputMustMatch: []*regexp.Regexp{
regexp.MustCompile("Successfully created an api key:\ntest-api-key\n Expires: never\n Key: apikey.apikey.ay1pee2eye3key\n"),
regexp.MustCompile("Successfully created an api key:\ntest-api-key\n Expires: never\n Key: apikey.ay1pee2eye3key\n"),
},
},
user: brain.User{
Expand Down
2 changes: 1 addition & 1 deletion lib/brain/api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (key APIKey) PrettyPrint(wr io.Writer, detail prettyprint.DetailLevel) erro
{{ define "apikey_full" }}{{ template "apikey_sgl" . }}
Expire{{ if .Expired }}d{{ else }}s{{ end }}: {{ if eq .ExpiresAt "" }}never{{ else }}{{ .ExpiresAt }}{{ end -}}
{{ if .APIKey}}
Key: apikey.{{ .APIKey }}{{ end -}}
Key: {{ .APIKey }}{{ end -}}
{{ if len .Privileges | le 1 }}
Privileges:
Expand Down
2 changes: 1 addition & 1 deletion lib/brain/api_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestAPIKeyPrettyPrint(t *testing.T) {
level: prettyprint.Full,
in: brain.APIKey{
Label: "jeff",
APIKey: "abcdefgh",
APIKey: "apikey.abcdefgh",
ExpiresAt: "3006-01-01T01:01:01-0000",
},
out: `jeff
Expand Down

0 comments on commit 0f5252f

Please sign in to comment.