mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-05 16:26:28 +00:00
Remove incorrect "db.DefaultContext" usages (#35366)
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
||||
"time"
|
||||
|
||||
auth_model "code.gitea.io/gitea/models/auth"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
issues_model "code.gitea.io/gitea/models/issues"
|
||||
"code.gitea.io/gitea/models/perm"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
@@ -516,7 +515,7 @@ func doProtectBranchExt(ctx APITestContext, ruleName string, opts doProtectBranc
|
||||
}
|
||||
|
||||
if opts.UserToWhitelistPush != "" {
|
||||
user, err := user_model.GetUserByName(db.DefaultContext, opts.UserToWhitelistPush)
|
||||
user, err := user_model.GetUserByName(t.Context(), opts.UserToWhitelistPush)
|
||||
assert.NoError(t, err)
|
||||
formData["whitelist_users"] = strconv.FormatInt(user.ID, 10)
|
||||
formData["enable_push"] = "whitelist"
|
||||
@@ -524,7 +523,7 @@ func doProtectBranchExt(ctx APITestContext, ruleName string, opts doProtectBranc
|
||||
}
|
||||
|
||||
if opts.UserToWhitelistForcePush != "" {
|
||||
user, err := user_model.GetUserByName(db.DefaultContext, opts.UserToWhitelistForcePush)
|
||||
user, err := user_model.GetUserByName(t.Context(), opts.UserToWhitelistForcePush)
|
||||
assert.NoError(t, err)
|
||||
formData["force_push_allowlist_users"] = strconv.FormatInt(user.ID, 10)
|
||||
formData["enable_force_push"] = "whitelist"
|
||||
@@ -675,7 +674,7 @@ func doPushCreate(ctx APITestContext, u *url.URL) func(t *testing.T) {
|
||||
t.Run("SuccessfullyPushAndCreateTestRepository", doGitPushTestRepository(tmpDir, "origin", "master"))
|
||||
|
||||
// Finally, fetch repo from database and ensure the correct repository has been created
|
||||
repo, err := repo_model.GetRepositoryByOwnerAndName(db.DefaultContext, ctx.Username, ctx.Reponame)
|
||||
repo, err := repo_model.GetRepositoryByOwnerAndName(t.Context(), ctx.Username, ctx.Reponame)
|
||||
assert.NoError(t, err)
|
||||
assert.False(t, repo.IsEmpty)
|
||||
assert.True(t, repo.IsPrivate)
|
||||
@@ -815,7 +814,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, headBranch string
|
||||
pr1, pr2 *issues_model.PullRequest
|
||||
commit string
|
||||
)
|
||||
repo, err := repo_model.GetRepositoryByOwnerAndName(db.DefaultContext, ctx.Username, ctx.Reponame)
|
||||
repo, err := repo_model.GetRepositoryByOwnerAndName(t.Context(), ctx.Username, ctx.Reponame)
|
||||
require.NoError(t, err)
|
||||
|
||||
pullNum := unittest.GetCount(t, &issues_model.PullRequest{})
|
||||
|
Reference in New Issue
Block a user