summaryrefslogtreecommitdiffstats
path: root/services/pull/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 /services/pull/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 'services/pull/pull_test.go')
-rw-r--r--services/pull/pull_test.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/services/pull/pull_test.go b/services/pull/pull_test.go
index 769e3c72e9..22eefd1624 100644
--- a/services/pull/pull_test.go
+++ b/services/pull/pull_test.go
@@ -8,6 +8,7 @@ package pull
import (
"testing"
+ "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/unit"
@@ -40,18 +41,18 @@ func TestPullRequest_GetDefaultMergeMessage_InternalTracker(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
pr := unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{ID: 2})
- assert.NoError(t, pr.LoadBaseRepo())
+ assert.NoError(t, pr.LoadBaseRepo(db.DefaultContext))
gitRepo, err := git.OpenRepository(git.DefaultContext, pr.BaseRepo.RepoPath())
assert.NoError(t, err)
defer gitRepo.Close()
- mergeMessage, err := GetDefaultMergeMessage(gitRepo, pr, "")
+ mergeMessage, err := GetDefaultMergeMessage(db.DefaultContext, gitRepo, pr, "")
assert.NoError(t, err)
assert.Equal(t, "Merge pull request 'issue3' (#3) from branch2 into master", mergeMessage)
pr.BaseRepoID = 1
pr.HeadRepoID = 2
- mergeMessage, err = GetDefaultMergeMessage(gitRepo, pr, "")
+ mergeMessage, err = GetDefaultMergeMessage(db.DefaultContext, gitRepo, pr, "")
assert.NoError(t, err)
assert.Equal(t, "Merge pull request 'issue3' (#3) from user2/repo1:branch2 into master", mergeMessage)
}
@@ -70,12 +71,12 @@ func TestPullRequest_GetDefaultMergeMessage_ExternalTracker(t *testing.T) {
pr := unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{ID: 2, BaseRepo: baseRepo})
- assert.NoError(t, pr.LoadBaseRepo())
+ assert.NoError(t, pr.LoadBaseRepo(db.DefaultContext))
gitRepo, err := git.OpenRepository(git.DefaultContext, pr.BaseRepo.RepoPath())
assert.NoError(t, err)
defer gitRepo.Close()
- mergeMessage, err := GetDefaultMergeMessage(gitRepo, pr, "")
+ mergeMessage, err := GetDefaultMergeMessage(db.DefaultContext, gitRepo, pr, "")
assert.NoError(t, err)
assert.Equal(t, "Merge pull request 'issue3' (!3) from branch2 into master", mergeMessage)
@@ -84,7 +85,7 @@ func TestPullRequest_GetDefaultMergeMessage_ExternalTracker(t *testing.T) {
pr.HeadRepoID = 2
pr.BaseRepo = nil
pr.HeadRepo = nil
- mergeMessage, err = GetDefaultMergeMessage(gitRepo, pr, "")
+ mergeMessage, err = GetDefaultMergeMessage(db.DefaultContext, gitRepo, pr, "")
assert.NoError(t, err)
assert.Equal(t, "Merge pull request 'issue3' (#3) from user2/repo2:branch2 into master", mergeMessage)