Refactor integration test DecodeJSON calls to use generic return value (#37432)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: wxiaoguang <2114189+wxiaoguang@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Copilot
2026-04-26 14:57:07 +00:00
committed by GitHub
parent 99cd4f6b22
commit 2671b997f2
105 changed files with 569 additions and 930 deletions
+2 -4
View File
@@ -47,8 +47,7 @@ func TestAPIViewPulls(t *testing.T) {
AddTokenAuth(ctx.Token)
resp := ctx.Session.MakeRequest(t, req, http.StatusOK)
var pulls []*api.PullRequest
DecodeJSON(t, resp, &pulls)
pulls := DecodeJSON(t, resp, []*api.PullRequest{})
expectedLen := unittest.GetCount(t, &issues_model.Issue{RepoID: repo.ID}, unittest.Cond("is_pull = ?", true))
assert.Len(t, pulls, expectedLen)
@@ -550,8 +549,7 @@ func doAPIGetPullFiles(ctx APITestContext, pr *api.PullRequest, callback func(*t
}
resp := ctx.Session.MakeRequest(t, req, ctx.ExpectedCode)
files := make([]*api.ChangedFile, 0, 1)
DecodeJSON(t, resp, &files)
files := DecodeJSON(t, resp, []*api.ChangedFile{})
if callback != nil {
callback(t, files)