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>
This commit is contained in:
parent
fefdb7ffd1
commit
044c754ea5
148 changed files with 1411 additions and 1564 deletions
|
@ -84,7 +84,7 @@ func TestGiteaUploadRepo(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Len(t, labels, 12)
|
||||
|
||||
releases, err := repo_model.GetReleasesByRepoID(repo.ID, repo_model.FindReleasesOptions{
|
||||
releases, err := repo_model.GetReleasesByRepoID(db.DefaultContext, repo.ID, repo_model.FindReleasesOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: 10,
|
||||
Page: 0,
|
||||
|
@ -94,7 +94,7 @@ func TestGiteaUploadRepo(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Len(t, releases, 8)
|
||||
|
||||
releases, err = repo_model.GetReleasesByRepoID(repo.ID, repo_model.FindReleasesOptions{
|
||||
releases, err = repo_model.GetReleasesByRepoID(db.DefaultContext, repo.ID, repo_model.FindReleasesOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: 10,
|
||||
Page: 0,
|
||||
|
@ -104,14 +104,14 @@ func TestGiteaUploadRepo(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Len(t, releases, 1)
|
||||
|
||||
issues, err := issues_model.Issues(&issues_model.IssuesOptions{
|
||||
issues, err := issues_model.Issues(db.DefaultContext, &issues_model.IssuesOptions{
|
||||
RepoID: repo.ID,
|
||||
IsPull: util.OptionalBoolFalse,
|
||||
SortType: "oldest",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, issues, 15)
|
||||
assert.NoError(t, issues[0].LoadDiscussComments())
|
||||
assert.NoError(t, issues[0].LoadDiscussComments(db.DefaultContext))
|
||||
assert.Empty(t, issues[0].Comments)
|
||||
|
||||
pulls, _, err := issues_model.PullRequests(repo.ID, &issues_model.PullRequestsOptions{
|
||||
|
@ -119,8 +119,8 @@ func TestGiteaUploadRepo(t *testing.T) {
|
|||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Len(t, pulls, 30)
|
||||
assert.NoError(t, pulls[0].LoadIssue())
|
||||
assert.NoError(t, pulls[0].Issue.LoadDiscussComments())
|
||||
assert.NoError(t, pulls[0].LoadIssue(db.DefaultContext))
|
||||
assert.NoError(t, pulls[0].Issue.LoadDiscussComments(db.DefaultContext))
|
||||
assert.Len(t, pulls[0].Issue.Comments, 2)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue