Skip to content

Commit

Permalink
Test hardning for lower case token types in Unleash (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
Starefossen authored Dec 28, 2023
1 parent 3324da7 commit 0c30436
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions controllers/apitoken_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var _ = Describe("ApiToken controller", func() {
existingTokens.Tokens = append(existingTokens.Tokens, unleashclient.ApiToken{
Secret: ApiTokenSecret,
Username: tokenRequest.Username,
Type: tokenRequest.Type,
Type: strings.ToLower(tokenRequest.Type),
Environment: tokenRequest.Environment,
Project: tokenRequest.Projects[0],
Projects: tokenRequest.Projects,
Expand Down Expand Up @@ -213,7 +213,7 @@ var _ = Describe("ApiToken controller", func() {
Expect(httpmock.GetCallCountInfo()[fmt.Sprintf("POST %s", unleashclient.ApiTokensEndpoint)]).Should(Equal(1))
Expect(existingTokens.Tokens).Should(HaveLen(1))
Expect(existingTokens.Tokens[0].Username).Should(Equal(apiTokenCreated.ApiTokenName("unleasherator")))
Expect(existingTokens.Tokens[0].Type).Should(Equal("CLIENT"))
Expect(existingTokens.Tokens[0].Type).Should(Equal("client"))
Expect(existingTokens.Tokens[0].Environment).Should(Equal("development"))
Expect(existingTokens.Tokens[0].Projects).Should(Equal([]string{"default"}))

Expand Down Expand Up @@ -268,7 +268,7 @@ var _ = Describe("ApiToken controller", func() {

Expect(httpmock.GetCallCountInfo()[fmt.Sprintf("POST %s", unleashclient.ApiTokensEndpoint)]).Should(Equal(1))
Expect(existingTokens.Tokens).Should(HaveLen(1))
Expect(existingTokens.Tokens[0].Type).Should(Equal("FRONTEND"))
Expect(existingTokens.Tokens[0].Type).Should(Equal("frontend"))
Expect(existingTokens.Tokens[0].Environment).Should(Equal("production"))
Expect(existingTokens.Tokens[0].Projects).Should(Equal([]string{"project1", "project2", "project3"}))

Expand Down

0 comments on commit 0c30436

Please sign in to comment.