Skip to content

Commit 3fb8da7

Browse files
committed
Added integration test for creating PRs from base repos to a fork
1 parent bde115d commit 3fb8da7

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tests/integration/pull_create_test.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,25 @@ Create a PR on user2/fork-repo
210210
Test checks:
211211
Check 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

Comments
 (0)