From de979e82d2ebc5dbd3eeb565aedd23669f052709 Mon Sep 17 00:00:00 2001 From: telyn Date: Wed, 9 Jan 2019 15:14:53 +0000 Subject: [PATCH 1/3] fix duplicated "apikey." prefix when creating an API key --- lib/brain/api_key.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/brain/api_key.go b/lib/brain/api_key.go index 58c5f416..e0a9b3f2 100644 --- a/lib/brain/api_key.go +++ b/lib/brain/api_key.go @@ -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: From 59f1c5efc822eca000e6d9f3ccbacd8b0229f795 Mon Sep 17 00:00:00 2001 From: telyn Date: Wed, 9 Jan 2019 15:20:24 +0000 Subject: [PATCH 2/3] fix test which expected duplicated apikey. prefix... seriously telyn? what the heck --- cmd/bytemark/commands/add/api_key_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/bytemark/commands/add/api_key_test.go b/cmd/bytemark/commands/add/api_key_test.go index 68155e4e..b55c6b6b 100644 --- a/cmd/bytemark/commands/add/api_key_test.go +++ b/cmd/bytemark/commands/add/api_key_test.go @@ -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{ From 53a27fa220a4d8fc57e2bdd56f6329ac73f30d8f Mon Sep 17 00:00:00 2001 From: telyn Date: Wed, 9 Jan 2019 15:41:16 +0000 Subject: [PATCH 3/3] fix TestAPIKeyPrettyPrint - missed due to hubris --- lib/brain/api_key_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/brain/api_key_test.go b/lib/brain/api_key_test.go index 4ac208a8..461de809 100644 --- a/lib/brain/api_key_test.go +++ b/lib/brain/api_key_test.go @@ -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