aboutsummaryrefslogtreecommitdiffstats
path: root/integrations/api_admin_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/api_admin_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/api_admin_test.go')
-rw-r--r--integrations/api_admin_test.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/integrations/api_admin_test.go b/integrations/api_admin_test.go
index 825aed9d50..eda8f076c3 100644
--- a/integrations/api_admin_test.go
+++ b/integrations/api_admin_test.go
@@ -16,7 +16,7 @@ import (
)
func TestAPIAdminCreateAndDeleteSSHKey(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
// user1 is an admin user
session := loginUser(t, "user1")
keyOwner := models.AssertExistsAndLoadBean(t, &models.User{Name: "user2"}).(*models.User)
@@ -46,7 +46,7 @@ func TestAPIAdminCreateAndDeleteSSHKey(t *testing.T) {
}
func TestAPIAdminDeleteMissingSSHKey(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
// user1 is an admin user
session := loginUser(t, "user1")
@@ -56,7 +56,7 @@ func TestAPIAdminDeleteMissingSSHKey(t *testing.T) {
}
func TestAPIAdminDeleteUnauthorizedKey(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
adminUsername := "user1"
normalUsername := "user2"
session := loginUser(t, adminUsername)
@@ -79,7 +79,7 @@ func TestAPIAdminDeleteUnauthorizedKey(t *testing.T) {
}
func TestAPISudoUser(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
adminUsername := "user1"
normalUsername := "user2"
session := loginUser(t, adminUsername)
@@ -95,7 +95,7 @@ func TestAPISudoUser(t *testing.T) {
}
func TestAPISudoUserForbidden(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
adminUsername := "user1"
normalUsername := "user2"
@@ -108,7 +108,7 @@ func TestAPISudoUserForbidden(t *testing.T) {
}
func TestAPIListUsers(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
adminUsername := "user1"
session := loginUser(t, adminUsername)
token := getTokenForLoggedInUser(t, session)
@@ -131,13 +131,13 @@ func TestAPIListUsers(t *testing.T) {
}
func TestAPIListUsersNotLoggedIn(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
req := NewRequest(t, "GET", "/api/v1/admin/users")
MakeRequest(t, req, http.StatusUnauthorized)
}
func TestAPIListUsersNonAdmin(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
nonAdminUsername := "user2"
session := loginUser(t, nonAdminUsername)
token := getTokenForLoggedInUser(t, session)