mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Even more db.DefaultContext
refactor (#27352)
Part of #27065 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
@@ -45,7 +45,7 @@ func TestPullRequestTargetEvent(t *testing.T) {
|
||||
assert.NotEmpty(t, baseRepo)
|
||||
|
||||
// enable actions
|
||||
err = repo_model.UpdateRepositoryUnits(baseRepo, []repo_model.RepoUnit{{
|
||||
err = repo_model.UpdateRepositoryUnits(db.DefaultContext, baseRepo, []repo_model.RepoUnit{{
|
||||
RepoID: baseRepo.ID,
|
||||
Type: unit_model.TypeActions,
|
||||
}}, nil)
|
||||
|
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
auth_model "code.gitea.io/gitea/models/auth"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
issues_model "code.gitea.io/gitea/models/issues"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
@@ -44,7 +45,7 @@ func TestAPIIssueSubscriptions(t *testing.T) {
|
||||
|
||||
assert.EqualValues(t, isWatching, wi.Subscribed)
|
||||
assert.EqualValues(t, !isWatching, wi.Ignored)
|
||||
assert.EqualValues(t, issue.APIURL()+"/subscriptions", wi.URL)
|
||||
assert.EqualValues(t, issue.APIURL(db.DefaultContext)+"/subscriptions", wi.URL)
|
||||
assert.EqualValues(t, issue.CreatedUnix, wi.CreatedAt.Unix())
|
||||
assert.EqualValues(t, issueRepo.APIURL(), wi.RepositoryURL)
|
||||
}
|
||||
|
@@ -100,7 +100,7 @@ func TestAPINotification(t *testing.T) {
|
||||
assert.True(t, apiN.Unread)
|
||||
assert.EqualValues(t, "issue4", apiN.Subject.Title)
|
||||
assert.EqualValues(t, "Issue", apiN.Subject.Type)
|
||||
assert.EqualValues(t, thread5.Issue.APIURL(), apiN.Subject.URL)
|
||||
assert.EqualValues(t, thread5.Issue.APIURL(db.DefaultContext), apiN.Subject.URL)
|
||||
assert.EqualValues(t, thread5.Repository.HTMLURL(), apiN.Repository.HTMLURL)
|
||||
|
||||
MakeRequest(t, NewRequest(t, "GET", "/api/v1/notifications/new"), http.StatusUnauthorized)
|
||||
|
@@ -414,7 +414,7 @@ func TestLDAPGroupTeamSyncAddMember(t *testing.T) {
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{
|
||||
Name: gitLDAPUser.UserName,
|
||||
})
|
||||
usersOrgs, err := organization.FindOrgs(organization.FindOrgOptions{
|
||||
usersOrgs, err := organization.FindOrgs(db.DefaultContext, organization.FindOrgOptions{
|
||||
UserID: user.ID,
|
||||
IncludePrivate: true,
|
||||
})
|
||||
@@ -458,7 +458,7 @@ func TestLDAPGroupTeamSyncRemoveMember(t *testing.T) {
|
||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{
|
||||
Name: gitLDAPUsers[0].UserName,
|
||||
})
|
||||
err = organization.AddOrgUser(org.ID, user.ID)
|
||||
err = organization.AddOrgUser(db.DefaultContext, org.ID, user.ID)
|
||||
assert.NoError(t, err)
|
||||
err = models.AddTeamMember(db.DefaultContext, team, user.ID)
|
||||
assert.NoError(t, err)
|
||||
|
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
auth_model "code.gitea.io/gitea/models/auth"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/organization"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
@@ -117,7 +118,7 @@ func doCheckOrgCounts(username string, orgCounts map[string]int, strict bool, ca
|
||||
Name: username,
|
||||
})
|
||||
|
||||
orgs, err := organization.FindOrgs(organization.FindOrgOptions{
|
||||
orgs, err := organization.FindOrgs(db.DefaultContext, organization.FindOrgOptions{
|
||||
UserID: user.ID,
|
||||
IncludePrivate: true,
|
||||
})
|
||||
|
Reference in New Issue
Block a user