0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-04-13 05:15:01 +02:00

more test fixes

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2025-11-25 21:49:33 -05:00
parent a9f1cc99fd
commit 60fd4472fd
No known key found for this signature in database
GPG Key ID: 924A5F6AF051E87C
4 changed files with 20 additions and 18 deletions

View File

@ -125,7 +125,7 @@ func testEditorActionEdit(t *testing.T, session *TestSession, groupID int64, use
resp := testEditorActionPostRequest(t, session, fmt.Sprintf("/%s/%s%s/%s/%s/%s", user, maybeGroupSegment(groupID), repo, editorAction, branch, filePath), params)
assert.Equal(t, http.StatusOK, resp.Code)
assert.NotEmpty(t, test.RedirectURL(resp))
req := NewRequest(t, "GET", path.Join(user, repo, "raw/branch", newBranchName, params["tree_path"]))
req := NewRequest(t, "GET", path.Join(user, maybeGroupSegment(groupID), repo, "raw/branch", newBranchName, params["tree_path"]))
resp = session.MakeRequest(t, req, http.StatusOK)
assert.Equal(t, params["content"], resp.Body.String())
return resp

View File

@ -103,13 +103,14 @@ func TestPullCompare_EnableAllowEditsFromMaintainer(t *testing.T) {
// user4 creates a new branch and a PR
testEditFileToNewBranch(t, user4Session, 0, "user4", forkedRepoName, "master", "user4/update-readme", "README.md", "Hello, World\n(Edited by user4)\n")
resp := testPullCreateDirectly(t, user4Session, createPullRequestOptions{
BaseRepoOwner: repo3.OwnerName,
BaseRepoName: repo3.Name,
BaseBranch: "master",
HeadRepoOwner: "user4",
HeadRepoName: forkedRepoName,
HeadBranch: "user4/update-readme",
Title: "PR for user4 forked repo3",
BaseRepoOwner: repo3.OwnerName,
BaseRepoName: repo3.Name,
BaseRepoGroupID: repo3.GroupID,
BaseBranch: "master",
HeadRepoOwner: "user4",
HeadRepoName: forkedRepoName,
HeadBranch: "user4/update-readme",
Title: "PR for user4 forked repo3",
})
prURL := test.RedirectURL(resp)

View File

@ -65,14 +65,15 @@ func testPullCreate(t *testing.T, session *TestSession, user, repo string, toSel
}
type createPullRequestOptions struct {
BaseRepoOwner string
BaseRepoName string
BaseBranch string
HeadRepoOwner string
HeadRepoName string
HeadBranch string
Title string
ReviewerIDs string // comma-separated list of user IDs
BaseRepoOwner string
BaseRepoName string
BaseRepoGroupID int64
BaseBranch string
HeadRepoOwner string
HeadRepoName string
HeadBranch string
Title string
ReviewerIDs string // comma-separated list of user IDs
}
func (opts createPullRequestOptions) IsValid() bool {
@ -93,7 +94,7 @@ func testPullCreateDirectly(t *testing.T, session *TestSession, opts createPullR
headCompare = fmt.Sprintf("%s:%s", opts.HeadRepoOwner, opts.HeadBranch)
}
}
req := NewRequest(t, "GET", fmt.Sprintf("/%s/%s/compare/%s...%s", opts.BaseRepoOwner, opts.BaseRepoName, opts.BaseBranch, headCompare))
req := NewRequest(t, "GET", fmt.Sprintf("/%s/%s%s/compare/%s...%s", opts.BaseRepoOwner, maybeGroupSegment(opts.BaseRepoGroupID), opts.BaseRepoName, opts.BaseBranch, headCompare))
resp := session.MakeRequest(t, req, http.StatusOK)
// Submit the form for creating the pull

View File

@ -220,7 +220,7 @@ func TestPullView_GivenApproveOrRejectReviewOnClosedPR(t *testing.T) {
user2Session := loginUser(t, "user2")
// Have user1 create a fork of repo1.
testRepoFork(t, user1Session, 0, "user1", "repo1", "user2", "repo1", "")
testRepoFork(t, user1Session, 0, "user2", "repo1", "user1", "repo1", "")
t.Run("Submit approve/reject review on merged PR", func(t *testing.T) {
// Create a merged PR (made by user1) in the upstream repo1.