Skip to content

Commit

Permalink
test: fix ErrorContains (#9445)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crenshaw <michael@crenshaw.dev>
  • Loading branch information
crenshaw-dev committed May 18, 2022
1 parent ac8b7df commit cf1f44e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server/server_test.go
Expand Up @@ -614,7 +614,8 @@ func TestAuthenticate_3rd_party_JWTs(t *testing.T) {
assert.Equal(t, testDataCopy.expectedClaims, claims)
}
if testDataCopy.expectedErrorContains != "" {
assert.ErrorContains(t, err, testDataCopy.expectedErrorContains, "Authenticate should have thrown an error and blocked the request")
assert.Error(t, err, "Authenticate should have thrown an error and blocked the request")
assert.Contains(t, err.Error(), testDataCopy.expectedErrorContains)
} else {
assert.NoError(t, err)
}
Expand Down Expand Up @@ -657,7 +658,8 @@ func TestAuthenticate_no_request_metadata(t *testing.T) {
claims := ctx.Value("claims")
assert.Equal(t, testDataCopy.expectedClaims, claims)
if testDataCopy.expectedErrorContains != "" {
assert.ErrorContains(t, err, testDataCopy.expectedErrorContains, "Authenticate should have thrown an error and blocked the request")
assert.Error(t, err, "Authenticate should have thrown an error and blocked the request")
assert.Contains(t, err.Error(), testDataCopy.expectedErrorContains)
} else {
assert.NoError(t, err)
}
Expand Down Expand Up @@ -704,7 +706,8 @@ func TestAuthenticate_no_SSO(t *testing.T) {
claims := ctx.Value("claims")
assert.Equal(t, testDataCopy.expectedClaims, claims)
if testDataCopy.expectedErrorMessage != "" {
assert.ErrorContains(t, err, testDataCopy.expectedErrorMessage, "Authenticate should have thrown an error and blocked the request")
assert.Error(t, err, "Authenticate should have thrown an error and blocked the request")
assert.Contains(t, err.Error(), testDataCopy.expectedErrorMessage)
} else {
assert.NoError(t, err)
}
Expand Down Expand Up @@ -807,7 +810,8 @@ func TestAuthenticate_bad_request_metadata(t *testing.T) {
claims := ctx.Value("claims")
assert.Equal(t, testDataCopy.expectedClaims, claims)
if testDataCopy.expectedErrorMessage != "" {
assert.ErrorContains(t, err, testDataCopy.expectedErrorMessage, "Authenticate should have thrown an error and blocked the request")
assert.Error(t, err, "Authenticate should have thrown an error and blocked the request")
assert.Contains(t, err.Error(), testDataCopy.expectedErrorMessage)
} else {
assert.NoError(t, err)
}
Expand Down

0 comments on commit cf1f44e

Please sign in to comment.