@@ -44,16 +44,22 @@ import (
44
44
"github.com/stretchr/testify/require"
45
45
)
46
46
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 {
48
48
req := NewRequest (t , "GET" , path .Join (user , repo , "pulls" , pullnum ))
49
49
resp := session .MakeRequest (t , req , http .StatusOK )
50
50
51
51
htmlDoc := NewHTMLParser (t , resp .Body )
52
52
link := path .Join (user , repo , "pulls" , pullnum , "merge" )
53
53
54
+ message := ""
55
+ if len (messages ) > 0 {
56
+ message = messages [0 ]
57
+ }
58
+
54
59
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 ,
57
63
}
58
64
59
65
if deleteBranch {
@@ -167,7 +173,6 @@ func TestPullSquash(t *testing.T) {
167
173
testEditFile (t , session , "user1" , "repo1" , "master" , "README.md" , "Hello, World (Edited!)\n " )
168
174
169
175
resp := testPullCreate (t , session , "user1" , "repo1" , false , "master" , "master" , "This is a pull title" )
170
-
171
176
prURL := test .RedirectURL (resp )
172
177
elem := strings .Split (prURL , "/" )
173
178
assert .Equal (t , "pulls" , elem [3 ])
@@ -232,7 +237,8 @@ func TestPullSquash(t *testing.T) {
232
237
}
233
238
}
234
239
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 )
236
242
237
243
req = NewRequest (t , "GET" , "/user2/repo1/src/branch/master/" )
238
244
resp = user2Session .MakeRequest (t , req , http .StatusOK )
0 commit comments