aboutsummaryrefslogtreecommitdiffstats
path: root/integrations/api_keys_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_keys_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_keys_test.go')
-rw-r--r--integrations/api_keys_test.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/integrations/api_keys_test.go b/integrations/api_keys_test.go
index d9686a063c..6979480543 100644
--- a/integrations/api_keys_test.go
+++ b/integrations/api_keys_test.go
@@ -17,13 +17,13 @@ import (
)
func TestViewDeployKeysNoLogin(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo1/keys")
MakeRequest(t, req, http.StatusUnauthorized)
}
func TestCreateDeployKeyNoLogin(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
req := NewRequestWithJSON(t, "POST", "/api/v1/repos/user2/repo1/keys", api.CreateKeyOption{
Title: "title",
Key: "key",
@@ -32,19 +32,19 @@ func TestCreateDeployKeyNoLogin(t *testing.T) {
}
func TestGetDeployKeyNoLogin(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo1/keys/1")
MakeRequest(t, req, http.StatusUnauthorized)
}
func TestDeleteDeployKeyNoLogin(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
req := NewRequest(t, "DELETE", "/api/v1/repos/user2/repo1/keys/1")
MakeRequest(t, req, http.StatusUnauthorized)
}
func TestCreateReadOnlyDeployKey(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
repo := models.AssertExistsAndLoadBean(t, &models.Repository{Name: "repo1"}).(*models.Repository)
repoOwner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
@@ -70,7 +70,7 @@ func TestCreateReadOnlyDeployKey(t *testing.T) {
}
func TestCreateReadWriteDeployKey(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
repo := models.AssertExistsAndLoadBean(t, &models.Repository{Name: "repo1"}).(*models.Repository)
repoOwner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
@@ -95,7 +95,7 @@ func TestCreateReadWriteDeployKey(t *testing.T) {
}
func TestCreateUserKey(t *testing.T) {
- prepareTestEnv(t)
+ defer prepareTestEnv(t)()
user := models.AssertExistsAndLoadBean(t, &models.User{Name: "user1"}).(*models.User)
session := loginUser(t, "user1")