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 Jun 14, 2022
1 parent 52f917a commit 0d74b68
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server/server_test.go
Expand Up @@ -612,7 +612,8 @@ func TestAuthenticate_3rd_party_JWTs(t *testing.T) {
assert.Equal(t, testDataCopy.expectedClaims, claims)
}
if testDataCopy.expectedErrorContains != "" {
assert.Contains(t, err.Error(), 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 @@ -655,7 +656,8 @@ func TestAuthenticate_no_request_metadata(t *testing.T) {
claims := ctx.Value("claims")
assert.Equal(t, testDataCopy.expectedClaims, claims)
if testDataCopy.expectedErrorContains != "" {
assert.Contains(t, err.Error(), 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 @@ -702,7 +704,8 @@ func TestAuthenticate_no_SSO(t *testing.T) {
claims := ctx.Value("claims")
assert.Equal(t, testDataCopy.expectedClaims, claims)
if testDataCopy.expectedErrorMessage != "" {
assert.Contains(t, err.Error(), 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 @@ -805,7 +808,8 @@ func TestAuthenticate_bad_request_metadata(t *testing.T) {
claims := ctx.Value("claims")
assert.Equal(t, testDataCopy.expectedClaims, claims)
if testDataCopy.expectedErrorMessage != "" {
assert.Contains(t, err.Error(), 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 0d74b68

Please sign in to comment.