fix(docs): convert APIKey to string EE-6199 (#10943)

This commit is contained in:
Dakota Walsh
2024-01-15 11:59:39 +13:00
committed by GitHub
parent d750389c67
commit 488fcc7cc5
10 changed files with 45 additions and 45 deletions

View File

@@ -64,5 +64,5 @@ func (handler *Handler) userGetAccessTokens(w http.ResponseWriter, r *http.Reque
// hideAPIKeyFields remove the digest from the API key (it is not needed in the response)
func hideAPIKeyFields(apiKey *portainer.APIKey) {
apiKey.Digest = nil
apiKey.Digest = ""
}

View File

@@ -68,7 +68,7 @@ func Test_userGetAccessTokens(t *testing.T) {
is.Len(resp, 1)
if len(resp) == 1 {
is.Nil(resp[0].Digest)
is.Equal(resp[0].Digest, "")
is.Equal(apiKey.ID, resp[0].ID)
is.Equal(apiKey.UserID, resp[0].UserID)
is.Equal(apiKey.Prefix, resp[0].Prefix)
@@ -129,10 +129,10 @@ func Test_hideAPIKeyFields(t *testing.T) {
UserID: 2,
Prefix: "abc",
Description: "test",
Digest: nil,
Digest: "",
}
hideAPIKeyFields(apiKey)
is.Nil(apiKey.Digest, "digest should be cleared when hiding api key fields")
is.Equal(apiKey.Digest, "", "digest should be cleared when hiding api key fields")
}