mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Consolidate boilerplate in integration tests (#1979)
This commit is contained in:
@@ -5,9 +5,7 @@
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
@@ -20,14 +18,12 @@ func TestSignup(t *testing.T) {
|
||||
|
||||
setting.Service.EnableCaptcha = false
|
||||
|
||||
req := NewRequestBody(t, "POST", "/user/sign_up",
|
||||
bytes.NewBufferString(url.Values{
|
||||
"user_name": []string{"exampleUser"},
|
||||
"email": []string{"exampleUser@example.com"},
|
||||
"password": []string{"examplePassword"},
|
||||
"retype": []string{"examplePassword"},
|
||||
}.Encode()),
|
||||
)
|
||||
req := NewRequestWithValues(t, "POST", "/user/sign_up", map[string]string{
|
||||
"user_name": "exampleUser",
|
||||
"email": "exampleUser@example.com",
|
||||
"password": "examplePassword",
|
||||
"retype": "examplePassword",
|
||||
})
|
||||
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||
resp := MakeRequest(req)
|
||||
assert.EqualValues(t, http.StatusFound, resp.HeaderCode)
|
||||
|
Reference in New Issue
Block a user