@@ -210,4 +210,25 @@ Create a PR on user2/fork-repo
210210Test checks:
211211Check if pull request is created and has a changed README.md
212212*/
213- // func TestPullCreatePrFromBaseToFork(t *testing.T) {}
213+ func TestPullCreatePrFromBaseToFork (t * testing.T ) {
214+ onGiteaRun (t , func (t * testing.T , u * url.URL ) {
215+ session := loginUser (t , "user1" )
216+ testRepoFork (t , session , "user2" , "fork-repo" , "user1" , "base-repo" , "" )
217+
218+ // Push extra commit to base-repo
219+ testEditFile (t , session , "user1" , "base-repo" , "master" , "README.md" , "Hello, World (Edited)\n " )
220+
221+ // Create PR
222+ resp := testPullCreate (t , session , "user1" , "base-repo" , false , "master" , "master" , "This is a pull title" )
223+
224+ // check the redirected URL
225+ url := test .RedirectURL (resp )
226+ assert .Regexp (t , "^/user2/fork-repo/pulls/[0-9]*$" , url )
227+
228+ // check .diff can be accessed and has a changed README.md
229+ req := NewRequest (t , "GET" , url + ".diff" )
230+ resp = session .MakeRequest (t , req , http .StatusOK )
231+ assert .Regexp (t , `\+Hello, World \(Edited\)` , resp .Body )
232+ assert .Regexp (t , "^diff" , resp .Body )
233+ })
234+ }
0 commit comments