summaryrefslogtreecommitdiffstats
path: root/modules/convert/pull_test.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-11-19 09:12:33 +0100
committerGitHub <noreply@github.com>2022-11-19 16:12:33 +0800
commit044c754ea53f5b81f451451df53aea366f6f700a (patch)
tree45688c28a84f87f71ec3f99eb0e8456eb7d19c42 /modules/convert/pull_test.go
parentfefdb7ffd11bbfbff66dae8e88681ec840dedfde (diff)
downloadgitea-044c754ea53f5b81f451451df53aea366f6f700a.tar.gz
gitea-044c754ea53f5b81f451451df53aea366f6f700a.zip
Add `context.Context` to more methods (#21546)
This PR adds a context parameter to a bunch of methods. Some helper `xxxCtx()` methods got replaced with the normal name now. Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules/convert/pull_test.go')
-rw-r--r--modules/convert/pull_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/convert/pull_test.go b/modules/convert/pull_test.go
index a6ccbaca58..a0a672d3a5 100644
--- a/modules/convert/pull_test.go
+++ b/modules/convert/pull_test.go
@@ -7,6 +7,7 @@ package convert
import (
"testing"
+ "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"
@@ -22,8 +23,8 @@ func TestPullRequest_APIFormat(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
headRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
pr := unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{ID: 1})
- assert.NoError(t, pr.LoadAttributes())
- assert.NoError(t, pr.LoadIssue())
+ assert.NoError(t, pr.LoadAttributes(db.DefaultContext))
+ assert.NoError(t, pr.LoadIssue(db.DefaultContext))
apiPullRequest := ToAPIPullRequest(git.DefaultContext, pr, nil)
assert.NotNil(t, apiPullRequest)
assert.EqualValues(t, &structs.PRBranchInfo{
@@ -36,8 +37,8 @@ func TestPullRequest_APIFormat(t *testing.T) {
// withOut HeadRepo
pr = unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{ID: 1})
- assert.NoError(t, pr.LoadIssue())
- assert.NoError(t, pr.LoadAttributes())
+ assert.NoError(t, pr.LoadIssue(db.DefaultContext))
+ assert.NoError(t, pr.LoadAttributes(db.DefaultContext))
// simulate fork deletion
pr.HeadRepo = nil
pr.HeadRepoID = 100000