@@ -44,16 +44,22 @@ import (
4444 "github.com/stretchr/testify/require"
4545)
4646
47- func testPullMerge (t * testing.T , session * TestSession , user , repo , pullnum string , mergeStyle repo_model.MergeStyle , deleteBranch bool ) * httptest.ResponseRecorder {
47+ func testPullMerge (t * testing.T , session * TestSession , user , repo , pullnum string , mergeStyle repo_model.MergeStyle , deleteBranch bool , messages ... string ) * httptest.ResponseRecorder {
4848 req := NewRequest (t , "GET" , path .Join (user , repo , "pulls" , pullnum ))
4949 resp := session .MakeRequest (t , req , http .StatusOK )
5050
5151 htmlDoc := NewHTMLParser (t , resp .Body )
5252 link := path .Join (user , repo , "pulls" , pullnum , "merge" )
5353
54+ message := ""
55+ if len (messages ) > 0 {
56+ message = messages [0 ]
57+ }
58+
5459 options := map [string ]string {
55- "_csrf" : htmlDoc .GetCSRF (),
56- "do" : string (mergeStyle ),
60+ "_csrf" : htmlDoc .GetCSRF (),
61+ "do" : string (mergeStyle ),
62+ "merge_message_field" : message ,
5763 }
5864
5965 if deleteBranch {
@@ -167,7 +173,6 @@ func TestPullSquash(t *testing.T) {
167173 testEditFile (t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited!)\n " )
168174
169175 resp := testPullCreate (t , session , "user1" , "repo1" , false , "master" , "master" , "This is a pull title" )
170-
171176 prURL := test .RedirectURL (resp )
172177 elem := strings .Split (prURL , "/" )
173178 assert .Equal (t , "pulls" , elem [3 ])
@@ -232,7 +237,8 @@ func TestPullSquash(t *testing.T) {
232237 }
233238 }
234239
235- testPullMerge (t , session , elem [1 ], elem [2 ], elem [4 ], repo_model .MergeStyleSquash , false )
240+ message := "This a pull description\n --------------------\n * user2 updated the file!\n * user2 updated the file\n * Update README.md\n * Update README.md\n "
241+ testPullMerge (t , session , elem [1 ], elem [2 ], elem [4 ], repo_model .MergeStyleSquash , false , message )
236242
237243 req = NewRequest (t , "GET" , "/user2/repo1/src/branch/master/" )
238244 resp = user2Session .MakeRequest (t , req , http .StatusOK )
0 commit comments