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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user