summaryrefslogtreecommitdiffstats
path: root/integrations/oauth_test.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2019-11-25 23:21:37 +0000
committerLauris BH <lauris@nix.lv>2019-11-26 01:21:37 +0200
commit055f6d229672524e3933940f95aa28939d94961a (patch)
tree72d1d427ce694517b70b6b751e35fdf6d5874428 /integrations/oauth_test.go
parentf5bd0884d2adea8ef7ba1bbd9dacb240d7c6b0f7 (diff)
downloadgitea-055f6d229672524e3933940f95aa28939d94961a.tar.gz
gitea-055f6d229672524e3933940f95aa28939d94961a.zip
Fix "data race" in testlogger (#9159)
* Fix data race in testlogger * Update git_helper_for_declarative_test.go
Diffstat (limited to 'integrations/oauth_test.go')
-rw-r--r--integrations/oauth_test.go20
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",