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:
@@ -25,8 +25,7 @@ func TestAPIListEmails(t *testing.T) {
|
||||
AddTokenAuth(token)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var emails []*api.Email
|
||||
DecodeJSON(t, resp, &emails)
|
||||
emails := DecodeJSON(t, resp, []*api.Email{})
|
||||
|
||||
assert.Equal(t, []*api.Email{
|
||||
{
|
||||
@@ -64,8 +63,7 @@ func TestAPIAddEmail(t *testing.T) {
|
||||
AddTokenAuth(token)
|
||||
resp := MakeRequest(t, req, http.StatusCreated)
|
||||
|
||||
var emails []*api.Email
|
||||
DecodeJSON(t, resp, &emails)
|
||||
emails := DecodeJSON(t, resp, []*api.Email{})
|
||||
assert.Equal(t, []*api.Email{
|
||||
{
|
||||
Email: "user2@example.com",
|
||||
@@ -117,8 +115,7 @@ func TestAPIDeleteEmail(t *testing.T) {
|
||||
AddTokenAuth(token)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var emails []*api.Email
|
||||
DecodeJSON(t, resp, &emails)
|
||||
emails := DecodeJSON(t, resp, []*api.Email{})
|
||||
assert.Equal(t, []*api.Email{
|
||||
{
|
||||
Email: "user2@example.com",
|
||||
|
||||
Reference in New Issue
Block a user