summaryrefslogtreecommitdiffstats
path: root/integrations/delete_user_test.go
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-07-07 15:36:47 -0400
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-07-07 21:36:47 +0200
commitf1adaef45849fc260b07be39a39b9c1ee5146923 (patch)
treebc33151ef4021ae14adf2e6cfc694b9e4729cef8 /integrations/delete_user_test.go
parent5651cc7413640f12a9eb8dee64d332ea9597afce (diff)
downloadgitea-f1adaef45849fc260b07be39a39b9c1ee5146923.tar.gz
gitea-f1adaef45849fc260b07be39a39b9c1ee5146923.zip
Less verbose integration tests (#2123)
* Helper functions for intergration test boilerplate
Diffstat (limited to 'integrations/delete_user_test.go')
-rw-r--r--integrations/delete_user_test.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/integrations/delete_user_test.go b/integrations/delete_user_test.go
index f766a29a1b..889f8dae25 100644
--- a/integrations/delete_user_test.go
+++ b/integrations/delete_user_test.go
@@ -9,8 +9,6 @@ import (
"testing"
"code.gitea.io/gitea/models"
-
- "github.com/stretchr/testify/assert"
)
func TestDeleteUser(t *testing.T) {
@@ -18,16 +16,11 @@ func TestDeleteUser(t *testing.T) {
session := loginUser(t, "user1")
- req := NewRequest(t, "GET", "/admin/users/8")
- resp := session.MakeRequest(t, req)
- assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
-
- doc := NewHTMLParser(t, resp.Body)
- req = NewRequestWithValues(t, "POST", "/admin/users/8/delete", map[string]string{
- "_csrf": doc.GetCSRF(),
+ csrf := GetCSRF(t, session, "/admin/users/8")
+ req := NewRequestWithValues(t, "POST", "/admin/users/8/delete", map[string]string{
+ "_csrf": csrf,
})
- resp = session.MakeRequest(t, req)
- assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
+ session.MakeRequest(t, req, http.StatusOK)
models.AssertNotExistsBean(t, &models.User{ID: 8})
models.CheckConsistencyFor(t, &models.User{})