From 1e6e9e0c0e280e58786376af413914b48c0541ee Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Wed, 10 May 2023 16:52:09 -0700 Subject: [PATCH] Change tests to expect new error format from pkg golang.org/x/oauth2 --- test/integration/supervisor_login_test.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/test/integration/supervisor_login_test.go b/test/integration/supervisor_login_test.go index 2f517d41..fb8efd09 100644 --- a/test/integration/supervisor_login_test.go +++ b/test/integration/supervisor_login_test.go @@ -1738,9 +1738,8 @@ func TestSupervisorLogin_Browser(t *testing.T) { return env.SupervisorUpstreamLDAP.TestUserMailAttributeValue, // username to present to server during login env.SupervisorUpstreamLDAP.TestUserPassword // password to present to server during login }, - requestAuthorization: requestAuthorizationUsingBrowserAuthcodeFlowLDAP, - wantAuthcodeExchangeError: "oauth2: cannot fetch token: 401 Unauthorized\n" + - `Response: {"error":"invalid_client","error_description":"Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method)."}`, + requestAuthorization: requestAuthorizationUsingBrowserAuthcodeFlowLDAP, + wantAuthcodeExchangeError: `oauth2: "invalid_client" "Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method)."`, }, } @@ -2239,12 +2238,7 @@ func testSupervisorLogin( _, err = downstreamOAuth2Config.TokenSource(oidcHTTPClientContext, &oauth2.Token{RefreshToken: latestRefreshToken}).Token() // Should have got an error since the upstream refresh should have failed. require.Error(t, err) - require.Regexp(t, - regexp.QuoteMeta("oauth2: cannot fetch token: 401 Unauthorized\n")+ - regexp.QuoteMeta(`Response: {"error":"error","error_description":"Error during upstream refresh. Upstream refresh failed`)+ - "[^']+", - err.Error(), - ) + require.EqualError(t, err, `oauth2: "error" "Error during upstream refresh. Upstream refresh failed."`) } }