@@ -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
0 commit comments