mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-30 12:32:49 +09:00
Remove wrong "git.DefaultContext" (#35364)
Some checks failed
Some checks failed
This commit is contained in:
@ -15,7 +15,6 @@ import (
|
||||
issues_model "code.gitea.io/gitea/models/issues"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
pull_service "code.gitea.io/gitea/services/pull"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
files_service "code.gitea.io/gitea/services/repository/files"
|
||||
@ -31,7 +30,7 @@ func TestAPIPullUpdate(t *testing.T) {
|
||||
pr := createOutdatedPR(t, user, org26)
|
||||
|
||||
// Test GetDiverging
|
||||
diffCount, err := pull_service.GetDiverging(git.DefaultContext, pr)
|
||||
diffCount, err := pull_service.GetDiverging(t.Context(), pr)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 1, diffCount.Behind)
|
||||
assert.Equal(t, 1, diffCount.Ahead)
|
||||
@ -45,7 +44,7 @@ func TestAPIPullUpdate(t *testing.T) {
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
// Test GetDiverging after update
|
||||
diffCount, err = pull_service.GetDiverging(git.DefaultContext, pr)
|
||||
diffCount, err = pull_service.GetDiverging(t.Context(), pr)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 0, diffCount.Behind)
|
||||
assert.Equal(t, 2, diffCount.Ahead)
|
||||
@ -60,7 +59,7 @@ func TestAPIPullUpdateByRebase(t *testing.T) {
|
||||
pr := createOutdatedPR(t, user, org26)
|
||||
|
||||
// Test GetDiverging
|
||||
diffCount, err := pull_service.GetDiverging(git.DefaultContext, pr)
|
||||
diffCount, err := pull_service.GetDiverging(t.Context(), pr)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 1, diffCount.Behind)
|
||||
assert.Equal(t, 1, diffCount.Ahead)
|
||||
@ -74,7 +73,7 @@ func TestAPIPullUpdateByRebase(t *testing.T) {
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
// Test GetDiverging after update
|
||||
diffCount, err = pull_service.GetDiverging(git.DefaultContext, pr)
|
||||
diffCount, err = pull_service.GetDiverging(t.Context(), pr)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 0, diffCount.Behind)
|
||||
assert.Equal(t, 1, diffCount.Ahead)
|
||||
@ -94,7 +93,7 @@ func createOutdatedPR(t *testing.T, actor, forkOrg *user_model.User) *issues_mod
|
||||
assert.NoError(t, err)
|
||||
assert.NotEmpty(t, baseRepo)
|
||||
|
||||
headRepo, err := repo_service.ForkRepository(git.DefaultContext, actor, forkOrg, repo_service.ForkRepoOptions{
|
||||
headRepo, err := repo_service.ForkRepository(t.Context(), actor, forkOrg, repo_service.ForkRepoOptions{
|
||||
BaseRepo: baseRepo,
|
||||
Name: "repo-pr-update",
|
||||
Description: "desc",
|
||||
@ -103,7 +102,7 @@ func createOutdatedPR(t *testing.T, actor, forkOrg *user_model.User) *issues_mod
|
||||
assert.NotEmpty(t, headRepo)
|
||||
|
||||
// create a commit on base Repo
|
||||
_, err = files_service.ChangeRepoFiles(git.DefaultContext, baseRepo, actor, &files_service.ChangeRepoFilesOptions{
|
||||
_, err = files_service.ChangeRepoFiles(t.Context(), baseRepo, actor, &files_service.ChangeRepoFilesOptions{
|
||||
Files: []*files_service.ChangeRepoFile{
|
||||
{
|
||||
Operation: "create",
|
||||
@ -130,7 +129,7 @@ func createOutdatedPR(t *testing.T, actor, forkOrg *user_model.User) *issues_mod
|
||||
assert.NoError(t, err)
|
||||
|
||||
// create a commit on head Repo
|
||||
_, err = files_service.ChangeRepoFiles(git.DefaultContext, headRepo, actor, &files_service.ChangeRepoFilesOptions{
|
||||
_, err = files_service.ChangeRepoFiles(t.Context(), headRepo, actor, &files_service.ChangeRepoFilesOptions{
|
||||
Files: []*files_service.ChangeRepoFile{
|
||||
{
|
||||
Operation: "create",
|
||||
@ -174,7 +173,7 @@ func createOutdatedPR(t *testing.T, actor, forkOrg *user_model.User) *issues_mod
|
||||
Type: issues_model.PullRequestGitea,
|
||||
}
|
||||
prOpts := &pull_service.NewPullRequestOptions{Repo: baseRepo, Issue: pullIssue, PullRequest: pullRequest}
|
||||
err = pull_service.NewPullRequest(git.DefaultContext, prOpts)
|
||||
err = pull_service.NewPullRequest(t.Context(), prOpts)
|
||||
assert.NoError(t, err)
|
||||
|
||||
issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{Title: "Test Pull -to-update-"})
|
||||
|
Reference in New Issue
Block a user