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:
@@ -22,8 +22,7 @@ func TestAPIListLabelTemplates(t *testing.T) {
|
||||
req := NewRequest(t, "GET", "/api/v1/label/templates")
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var templateList []string
|
||||
DecodeJSON(t, resp, &templateList)
|
||||
templateList := DecodeJSON(t, resp, []string{})
|
||||
|
||||
for i := range repo_module.LabelTemplateFiles {
|
||||
assert.Equal(t, repo_module.LabelTemplateFiles[i].DisplayName, templateList[i])
|
||||
@@ -45,8 +44,7 @@ func TestAPIGetLabelTemplateInfo(t *testing.T) {
|
||||
req := NewRequest(t, "GET", urlStr)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var templateInfo []api.LabelTemplate
|
||||
DecodeJSON(t, resp, &templateInfo)
|
||||
templateInfo := DecodeJSON(t, resp, []api.LabelTemplate{})
|
||||
|
||||
labels, err := repo_module.LoadTemplateLabelsByDisplayName(templateName)
|
||||
assert.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user