Skip to content

Commit 900dbb0

Browse files
committed
(chore) lint
1 parent e19db96 commit 900dbb0

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

server/server_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ func TestAuthenticate_3rd_party_JWTs(t *testing.T) {
816816
claims: jwt.RegisteredClaims{Audience: jwt.ClaimStrings{common.ArgoCDClientAppID}, Subject: "admin", ExpiresAt: jwt.NewNumericDate(time.Now())},
817817
expectedErrorContains: common.TokenVerificationError,
818818
// Set to nil so we can do a separate check for issuer presence
819-
expectedClaims: nil,
819+
expectedClaims: nil,
820820
},
821821
{
822822
test: "anonymous enabled, expired token, admin claim",
@@ -872,7 +872,7 @@ func TestAuthenticate_3rd_party_JWTs(t *testing.T) {
872872
useDex: true,
873873
expectedErrorContains: common.TokenVerificationError,
874874
// Set to nil so we can do a separate check for issuer presence
875-
expectedClaims: nil,
875+
expectedClaims: nil,
876876
},
877877
{
878878
test: "external OIDC: anonymous enabled, expired token, admin claim",
@@ -915,21 +915,22 @@ func TestAuthenticate_3rd_party_JWTs(t *testing.T) {
915915

916916
ctx, err = argocd.Authenticate(ctx)
917917
claims := ctx.Value("claims")
918-
918+
919919
// Special handling for expired token test cases
920-
if strings.Contains(testDataCopy.test, "expired token") && claims != nil {
920+
switch {
921+
case strings.Contains(testDataCopy.test, "expired token") && claims != nil:
921922
// For expired tokens, just verify that the claims contain an issuer field
922923
// without checking its specific value
923924
if mapClaims, ok := claims.(jwt.MapClaims); ok {
924925
_, hasIssuer := mapClaims["iss"]
925926
assert.True(t, hasIssuer, "Claims for expired token should include 'iss' field")
926927
}
927-
} else if testDataCopy.expectedClaims == nil {
928+
case testDataCopy.expectedClaims == nil:
928929
assert.Nil(t, claims)
929-
} else {
930+
default:
930931
assert.Equal(t, testDataCopy.expectedClaims, claims)
931932
}
932-
933+
933934
if testDataCopy.expectedErrorContains != "" {
934935
assert.ErrorContains(t, err, testDataCopy.expectedErrorContains, "Authenticate should have thrown an error and blocked the request")
935936
} else {

0 commit comments

Comments
 (0)