Skip to content

Commit daf7629

Browse files
committed
fix test
1 parent 40caf99 commit daf7629

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

tests/integration/pull_create_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/stretchr/testify/assert"
2121
)
2222

23-
func testPullCreate(t *testing.T, session *TestSession, user, repo string, toSelf bool, targetBranch, sourceBranch, title string) *httptest.ResponseRecorder {
23+
func testPullCreate(t *testing.T, session *TestSession, user, repo string, toSelf bool, targetBranch, sourceBranch, title string, contents ...string) *httptest.ResponseRecorder {
2424
req := NewRequest(t, "GET", path.Join(user, repo))
2525
resp := session.MakeRequest(t, req, http.StatusOK)
2626

@@ -52,9 +52,15 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo string, toSel
5252
htmlDoc = NewHTMLParser(t, resp.Body)
5353
link, exists = htmlDoc.doc.Find("form.ui.form").Attr("action")
5454
assert.True(t, exists, "The template has changed")
55+
56+
content := ""
57+
if len(contents) > 0 {
58+
content = contents[0]
59+
}
5560
req = NewRequestWithValues(t, "POST", link, map[string]string{
56-
"_csrf": htmlDoc.GetCSRF(),
57-
"title": title,
61+
"_csrf": htmlDoc.GetCSRF(),
62+
"title": title,
63+
"content": content,
5864
})
5965
resp = session.MakeRequest(t, req, http.StatusOK)
6066
return resp

tests/integration/pull_merge_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func TestPullSquash(t *testing.T) {
174174
testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited)\n")
175175
testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited!)\n")
176176

177-
resp := testPullCreate(t, session, "user1", "repo1", false, "master", "master", "This is a pull title")
177+
resp := testPullCreate(t, session, "user1", "repo1", false, "master", "master", "This is a pull title", "This is a pull content")
178178
prURL := test.RedirectURL(resp)
179179
elem := strings.Split(prURL, "/")
180180
assert.Equal(t, "pulls", elem[3])

0 commit comments

Comments
 (0)