summaryrefslogtreecommitdiffstats
path: root/integrations/pull_create_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'integrations/pull_create_test.go')
-rw-r--r--integrations/pull_create_test.go20
1 files changed, 7 insertions, 13 deletions
diff --git a/integrations/pull_create_test.go b/integrations/pull_create_test.go
index ac8df33c6a..f518c1bb55 100644
--- a/integrations/pull_create_test.go
+++ b/integrations/pull_create_test.go
@@ -5,9 +5,7 @@
package integrations
import (
- "bytes"
"net/http"
- "net/url"
"path"
"testing"
@@ -20,8 +18,7 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo, branch strin
assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
// Click the little green button to create a pull
- htmlDoc, err := NewHtmlParser(resp.Body)
- assert.NoError(t, err)
+ htmlDoc := NewHtmlParser(t, resp.Body)
link, exists := htmlDoc.doc.Find("button.ui.green.small.button").Parent().Attr("href")
assert.True(t, exists, "The template has changed")
@@ -30,16 +27,13 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo, branch strin
assert.EqualValues(t, http.StatusOK, resp.HeaderCode)
// Submit the form for creating the pull
- htmlDoc, err = NewHtmlParser(resp.Body)
- assert.NoError(t, err)
+ htmlDoc = NewHtmlParser(t, resp.Body)
link, exists = htmlDoc.doc.Find("form.ui.form").Attr("action")
assert.True(t, exists, "The template has changed")
- req = NewRequestBody(t, "POST", link,
- bytes.NewBufferString(url.Values{
- "_csrf": []string{htmlDoc.GetInputValueByName("_csrf")},
- "title": []string{"This is a pull title"},
- }.Encode()),
- )
+ req = NewRequestWithValues(t, "POST", link, map[string]string{
+ "_csrf": htmlDoc.GetCSRF(),
+ "title": "This is a pull title",
+ })
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
resp = session.MakeRequest(t, req)
assert.EqualValues(t, http.StatusFound, resp.HeaderCode)
@@ -51,7 +45,7 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo, branch strin
func TestPullCreate(t *testing.T) {
prepareTestEnv(t)
- session := loginUser(t, "user1", "password")
+ session := loginUser(t, "user1")
testRepoFork(t, session)
testEditFile(t, session, "user1", "repo1", "master", "README.md")
testPullCreate(t, session, "user1", "repo1", "master")