mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-08 14:03:24 +09:00
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:
co-authored by
copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
wxiaoguang
wxiaoguang
parent
99cd4f6b22
commit
2671b997f2
@@ -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