diff options
Diffstat (limited to 'integrations/oauth_test.go')
-rw-r--r-- | integrations/oauth_test.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/integrations/oauth_test.go b/integrations/oauth_test.go index ed5761a86b..1307baba89 100644 --- a/integrations/oauth_test.go +++ b/integrations/oauth_test.go @@ -16,20 +16,20 @@ import ( const defaultAuthorize = "/login/oauth/authorize?client_id=da7da3ba-9a13-4167-856f-3899de0b0138&redirect_uri=a&response_type=code&state=thestate" func TestNoClientID(t *testing.T) { - prepareTestEnv(t) + defer prepareTestEnv(t)() req := NewRequest(t, "GET", "/login/oauth/authorize") ctx := loginUser(t, "user2") ctx.MakeRequest(t, req, 400) } func TestLoginRedirect(t *testing.T) { - prepareTestEnv(t) + defer prepareTestEnv(t)() req := NewRequest(t, "GET", "/login/oauth/authorize") assert.Contains(t, MakeRequest(t, req, 302).Body.String(), "/user/login") } func TestShowAuthorize(t *testing.T) { - prepareTestEnv(t) + defer prepareTestEnv(t)() req := NewRequest(t, "GET", defaultAuthorize) ctx := loginUser(t, "user4") resp := ctx.MakeRequest(t, req, 200) @@ -40,7 +40,7 @@ func TestShowAuthorize(t *testing.T) { } func TestRedirectWithExistingGrant(t *testing.T) { - prepareTestEnv(t) + defer prepareTestEnv(t)() req := NewRequest(t, "GET", defaultAuthorize) ctx := loginUser(t, "user1") resp := ctx.MakeRequest(t, req, 302) @@ -51,7 +51,7 @@ func TestRedirectWithExistingGrant(t *testing.T) { } func TestAccessTokenExchange(t *testing.T) { - prepareTestEnv(t) + defer prepareTestEnv(t)() req := NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{ "grant_type": "authorization_code", "client_id": "da7da3ba-9a13-4167-856f-3899de0b0138", @@ -74,7 +74,7 @@ func TestAccessTokenExchange(t *testing.T) { } func TestAccessTokenExchangeWithoutPKCE(t *testing.T) { - prepareTestEnv(t) + defer prepareTestEnv(t)() req := NewRequestWithJSON(t, "POST", "/login/oauth/access_token", map[string]string{ "grant_type": "authorization_code", "client_id": "da7da3ba-9a13-4167-856f-3899de0b0138", @@ -97,7 +97,7 @@ func TestAccessTokenExchangeWithoutPKCE(t *testing.T) { } func TestAccessTokenExchangeJSON(t *testing.T) { - prepareTestEnv(t) + defer prepareTestEnv(t)() req := NewRequestWithJSON(t, "POST", "/login/oauth/access_token", map[string]string{ "grant_type": "authorization_code", "client_id": "da7da3ba-9a13-4167-856f-3899de0b0138", @@ -109,7 +109,7 @@ func TestAccessTokenExchangeJSON(t *testing.T) { } func TestAccessTokenExchangeWithInvalidCredentials(t *testing.T) { - prepareTestEnv(t) + defer prepareTestEnv(t)() // invalid client id req := NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{ "grant_type": "authorization_code", @@ -163,7 +163,7 @@ func TestAccessTokenExchangeWithInvalidCredentials(t *testing.T) { } func TestAccessTokenExchangeWithBasicAuth(t *testing.T) { - prepareTestEnv(t) + defer prepareTestEnv(t)() req := NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{ "grant_type": "authorization_code", "redirect_uri": "a", @@ -204,7 +204,7 @@ func TestAccessTokenExchangeWithBasicAuth(t *testing.T) { } func TestRefreshTokenInvalidation(t *testing.T) { - prepareTestEnv(t) + defer prepareTestEnv(t)() req := NewRequestWithValues(t, "POST", "/login/oauth/access_token", map[string]string{ "grant_type": "authorization_code", "client_id": "da7da3ba-9a13-4167-856f-3899de0b0138", |