mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 02:46:04 +01:00 
			
		
		
		
	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:
		| @@ -8,6 +8,7 @@ import ( | ||||
| 	"net/http" | ||||
| 	"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/unittest" | ||||
| @@ -19,12 +20,12 @@ import ( | ||||
|  | ||||
| func TestAPIPullCommits(t *testing.T) { | ||||
| 	defer tests.PrepareTestEnv(t)() | ||||
| 	pullIssue := unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{ID: 2}) | ||||
| 	assert.NoError(t, pullIssue.LoadIssue()) | ||||
| 	repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: pullIssue.HeadRepoID}) | ||||
| 	pr := unittest.AssertExistsAndLoadBean(t, &issues_model.PullRequest{ID: 2}) | ||||
| 	assert.NoError(t, pr.LoadIssue(db.DefaultContext)) | ||||
| 	repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: pr.HeadRepoID}) | ||||
|  | ||||
| 	session := loginUser(t, "user2") | ||||
| 	req := NewRequestf(t, http.MethodGet, "/api/v1/repos/%s/%s/pulls/%d/commits", repo.OwnerName, repo.Name, pullIssue.Index) | ||||
| 	req := NewRequestf(t, http.MethodGet, "/api/v1/repos/%s/%s/pulls/%d/commits", repo.OwnerName, repo.Name, pr.Index) | ||||
| 	resp := session.MakeRequest(t, req, http.StatusOK) | ||||
|  | ||||
| 	var commits []*api.Commit | ||||
|   | ||||
		Reference in New Issue
	
	Block a user