mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-03 23:22:39 +02:00
fix failing tests
This commit is contained in:
parent
6f76360208
commit
55ca263b89
@ -113,7 +113,7 @@ func FindGroupTeams(ctx context.Context, groupID int64) (gteams []*RepoGroupTeam
|
||||
Find(>eams)
|
||||
}
|
||||
|
||||
func FindUserGroupTeams(ctx context.Context, groupID int64, userID int64) (gteams []*RepoGroupTeam, err error) {
|
||||
func FindUserGroupTeams(ctx context.Context, groupID, userID int64) (gteams []*RepoGroupTeam, err error) {
|
||||
return gteams, db.GetEngine(ctx).
|
||||
Where("group_id=?", groupID).
|
||||
And("team_user.uid = ?", userID).
|
||||
|
||||
@ -1765,13 +1765,13 @@ func TestPullRequestWithPathsRebase(t *testing.T) {
|
||||
repoName := "actions-pr-paths-rebase"
|
||||
apiRepo := createActionsTestRepo(t, token, repoName, false)
|
||||
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: apiRepo.ID})
|
||||
apiCtx := NewAPITestContext(t, "user2", repoName, auth_model.AccessTokenScopeWriteRepository)
|
||||
apiCtx := NewAPITestContext(t, "user2", repoName, repo.GroupID, auth_model.AccessTokenScopeWriteRepository)
|
||||
runner := newMockRunner()
|
||||
runner.registerAsRepoRunner(t, "user2", repoName, "mock-runner", []string{"ubuntu-latest"}, false)
|
||||
|
||||
// init files and dirs
|
||||
testCreateFile(t, session, "user2", repoName, repo.DefaultBranch, "", "dir1/dir1.txt", "1")
|
||||
testCreateFile(t, session, "user2", repoName, repo.DefaultBranch, "", "dir2/dir2.txt", "2")
|
||||
testCreateFile(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "", "dir1/dir1.txt", "1")
|
||||
testCreateFile(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "", "dir2/dir2.txt", "2")
|
||||
wfFileContent := `name: ci
|
||||
on:
|
||||
pull_request:
|
||||
@ -1783,10 +1783,10 @@ jobs:
|
||||
steps:
|
||||
- run: echo 'ci'
|
||||
`
|
||||
testCreateFile(t, session, "user2", repoName, repo.DefaultBranch, "", ".gitea/workflows/ci.yml", wfFileContent)
|
||||
testCreateFile(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "", ".gitea/workflows/ci.yml", wfFileContent)
|
||||
|
||||
// create a PR to modify "dir1/dir1.txt", the workflow will be triggered
|
||||
testEditFileToNewBranch(t, session, "user2", repoName, repo.DefaultBranch, "update-dir1", "dir1/dir1.txt", "11")
|
||||
testEditFileToNewBranch(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "update-dir1", "dir1/dir1.txt", "11")
|
||||
_, err := doAPICreatePullRequest(apiCtx, "user2", repoName, repo.DefaultBranch, "update-dir1")(t)
|
||||
assert.NoError(t, err)
|
||||
pr1Task := runner.fetchTask(t)
|
||||
@ -1794,12 +1794,12 @@ jobs:
|
||||
assert.Equal(t, webhook_module.HookEventPullRequest, pr1Run.Event)
|
||||
|
||||
// create a PR to modify "dir2/dir2.txt" then update main branch and rebase, the workflow will not be triggered
|
||||
testEditFileToNewBranch(t, session, "user2", repoName, repo.DefaultBranch, "update-dir2", "dir2/dir2.txt", "22")
|
||||
testEditFileToNewBranch(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "update-dir2", "dir2/dir2.txt", "22")
|
||||
apiPull, err := doAPICreatePullRequest(apiCtx, "user2", repoName, repo.DefaultBranch, "update-dir2")(t)
|
||||
runner.fetchNoTask(t)
|
||||
assert.NoError(t, err)
|
||||
// change the file in "dir1"
|
||||
testEditFile(t, session, "user2", repoName, repo.DefaultBranch, "dir1/dir1.txt", "11")
|
||||
testEditFile(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "dir1/dir1.txt", "11")
|
||||
// update by rebase
|
||||
req := NewRequest(t, "POST", fmt.Sprintf("/%s/%s/pulls/%d/update?style=rebase", "user2", repoName, apiPull.Index))
|
||||
session.MakeRequest(t, req, http.StatusSeeOther)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user