aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-10-03 12:30:41 +0200
committerGitHub <noreply@github.com>2023-10-03 10:30:41 +0000
commitcc5df266808361c1dd3a1d17cbba712826a93d7e (patch)
treef77c59a61d3dc36f07b5b84596e4a1cde12b55cc /tests
parent08507e2760638124d75774c29ef37e692a88c02d (diff)
downloadgitea-cc5df266808361c1dd3a1d17cbba712826a93d7e.tar.gz
gitea-cc5df266808361c1dd3a1d17cbba712826a93d7e.zip
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/actions_trigger_test.go2
-rw-r--r--tests/integration/api_issue_subscription_test.go3
-rw-r--r--tests/integration/api_notification_test.go2
-rw-r--r--tests/integration/auth_ldap_test.go4
-rw-r--r--tests/integration/org_count_test.go3
5 files changed, 8 insertions, 6 deletions
diff --git a/tests/integration/actions_trigger_test.go b/tests/integration/actions_trigger_test.go
index 82c1967b52..253de70326 100644
--- a/tests/integration/actions_trigger_test.go
+++ b/tests/integration/actions_trigger_test.go
@@ -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)
diff --git a/tests/integration/api_issue_subscription_test.go b/tests/integration/api_issue_subscription_test.go
index 09c83b63b1..28650a3375 100644
--- a/tests/integration/api_issue_subscription_test.go
+++ b/tests/integration/api_issue_subscription_test.go
@@ -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)
}
diff --git a/tests/integration/api_notification_test.go b/tests/integration/api_notification_test.go
index 222b2c2e07..c6ee576e59 100644
--- a/tests/integration/api_notification_test.go
+++ b/tests/integration/api_notification_test.go
@@ -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)
diff --git a/tests/integration/auth_ldap_test.go b/tests/integration/auth_ldap_test.go
index eb6486fde1..ac4c41bf4d 100644
--- a/tests/integration/auth_ldap_test.go
+++ b/tests/integration/auth_ldap_test.go
@@ -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)
diff --git a/tests/integration/org_count_test.go b/tests/integration/org_count_test.go
index e46b83169b..d1aa41963e 100644
--- a/tests/integration/org_count_test.go
+++ b/tests/integration/org_count_test.go
@@ -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,
})