forked from forgejo/forgejo
Consolidate boilerplate in integration tests (#1979)
This commit is contained in:
parent
a3868ef536
commit
ce9b86082c
16 changed files with 147 additions and 166 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue