Skip to content

Commit

Permalink
Added integration test for creating PRs from base repos to a fork
Browse files Browse the repository at this point in the history
  • Loading branch information
LordChunk committed Sep 14, 2024
1 parent e368a6b commit a1c8f39
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/integration/pull_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,25 @@ Create a PR on user2/fork-repo
Test checks:
Check if pull request is created and has a changed README.md
*/
// func TestPullCreatePrFromBaseToFork(t *testing.T) {}
func TestPullCreatePrFromBaseToFork(t *testing.T) {
onGiteaRun(t, func(t *testing.T, u *url.URL) {
session := loginUser(t, "user1")
testRepoFork(t, session, "user2", "fork-repo", "user1", "base-repo", "")

// Push extra commit to base-repo
testEditFile(t, session, "user1", "base-repo", "master", "README.md", "Hello, World (Edited)\n")

// Create PR
resp := testPullCreate(t, session, "user1", "base-repo", false, "master", "master", "This is a pull title")

// check the redirected URL
url := test.RedirectURL(resp)
assert.Regexp(t, "^/user2/fork-repo/pulls/[0-9]*$", url)

// check .diff can be accessed and has a changed README.md
req := NewRequest(t, "GET", url+".diff")
resp = session.MakeRequest(t, req, http.StatusOK)
assert.Regexp(t, `\+Hello, World \(Edited\)`, resp.Body)
assert.Regexp(t, "^diff", resp.Body)
})
}

0 comments on commit a1c8f39

Please sign in to comment.