Skip to content

Commit d6a0746

Browse files
fix failing tests
1 parent 1277084 commit d6a0746

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

models/group/group_team.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func FindGroupTeams(ctx context.Context, groupID int64) (gteams []*RepoGroupTeam
113113
Find(&gteams)
114114
}
115115

116-
func FindUserGroupTeams(ctx context.Context, groupID int64, userID int64) (gteams []*RepoGroupTeam, err error) {
116+
func FindUserGroupTeams(ctx context.Context, groupID, userID int64) (gteams []*RepoGroupTeam, err error) {
117117
return gteams, db.GetEngine(ctx).
118118
Where("group_id=?", groupID).
119119
And("team_user.uid = ?", userID).

tests/integration/actions_trigger_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,15 +1606,15 @@ func TestPullRequestWithPathsRebase(t *testing.T) {
16061606
repoName := "actions-pr-paths-rebase"
16071607
apiRepo := createActionsTestRepo(t, token, repoName, false)
16081608
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: apiRepo.ID})
1609-
apiCtx := NewAPITestContext(t, "user2", repoName, auth_model.AccessTokenScopeWriteRepository)
1609+
apiCtx := NewAPITestContext(t, "user2", repoName, repo.GroupID, auth_model.AccessTokenScopeWriteRepository)
16101610
runner := newMockRunner()
16111611
runner.registerAsRepoRunner(t, "user2", repoName, "mock-runner", []string{"ubuntu-latest"}, false)
16121612

16131613
// init files and dirs
1614-
testCreateFile(t, session, "user2", repoName, repo.DefaultBranch, "", "dir1/dir1.txt", "1")
1615-
testCreateFile(t, session, "user2", repoName, repo.DefaultBranch, "", "dir2/dir2.txt", "2")
1614+
testCreateFile(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "", "dir1/dir1.txt", "1")
1615+
testCreateFile(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "", "dir2/dir2.txt", "2")
16161616
wfFileContent := `name: ci
1617-
on:
1617+
on:
16181618
pull_request:
16191619
paths:
16201620
- 'dir1/**'
@@ -1624,22 +1624,22 @@ jobs:
16241624
steps:
16251625
- run: echo 'ci'
16261626
`
1627-
testCreateFile(t, session, "user2", repoName, repo.DefaultBranch, "", ".gitea/workflows/ci.yml", wfFileContent)
1627+
testCreateFile(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "", ".gitea/workflows/ci.yml", wfFileContent)
16281628

16291629
// create a PR to modify "dir1/dir1.txt", the workflow will be triggered
1630-
testEditFileToNewBranch(t, session, "user2", repoName, repo.DefaultBranch, "update-dir1", "dir1/dir1.txt", "11")
1630+
testEditFileToNewBranch(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "update-dir1", "dir1/dir1.txt", "11")
16311631
_, err := doAPICreatePullRequest(apiCtx, "user2", repoName, repo.DefaultBranch, "update-dir1")(t)
16321632
assert.NoError(t, err)
16331633
pr1Task := runner.fetchTask(t)
16341634
_, _, pr1Run := getTaskAndJobAndRunByTaskID(t, pr1Task.Id)
16351635
assert.Equal(t, webhook_module.HookEventPullRequest, pr1Run.Event)
16361636

16371637
// create a PR to modify "dir2/dir2.txt" then update main branch and rebase, the workflow will not be triggered
1638-
testEditFileToNewBranch(t, session, "user2", repoName, repo.DefaultBranch, "update-dir2", "dir2/dir2.txt", "22")
1638+
testEditFileToNewBranch(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "update-dir2", "dir2/dir2.txt", "22")
16391639
apiPull, err := doAPICreatePullRequest(apiCtx, "user2", repoName, repo.DefaultBranch, "update-dir2")(t)
16401640
runner.fetchNoTask(t)
16411641
assert.NoError(t, err)
1642-
testEditFile(t, session, "user2", repoName, repo.DefaultBranch, "dir1/dir1.txt", "11") // change the file in "dir1"
1642+
testEditFile(t, session, repo.GroupID, "user2", repoName, repo.DefaultBranch, "dir1/dir1.txt", "11") // change the file in "dir1"
16431643
req := NewRequestWithValues(t, "POST",
16441644
fmt.Sprintf("/%s/%s/pulls/%d/update?style=rebase", "user2", repoName, apiPull.Index), // update by rebase
16451645
map[string]string{

0 commit comments

Comments
 (0)