mirror of
https://github.com/go-gitea/gitea
synced 2025-07-08 19:47:21 +00:00
Enable addtional linters (#34085)
enable mirror, usestdlibbars and perfsprint part of: https://github.com/go-gitea/gitea/issues/34083 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@ -4,7 +4,6 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
@ -31,7 +30,7 @@ func TestAPIUserInfo(t *testing.T) {
|
||||
t.Run("GetInfo", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s", user2)).
|
||||
req := NewRequest(t, "GET", "/api/v1/users/"+user2).
|
||||
AddTokenAuth(token)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
@ -39,17 +38,17 @@ func TestAPIUserInfo(t *testing.T) {
|
||||
DecodeJSON(t, resp, &u)
|
||||
assert.Equal(t, user2, u.UserName)
|
||||
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s", user2))
|
||||
req = NewRequest(t, "GET", "/api/v1/users/"+user2)
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
|
||||
// test if the placaholder Mail is returned if a User is not logged in
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s", org3.Name))
|
||||
req = NewRequest(t, "GET", "/api/v1/users/"+org3.Name)
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
DecodeJSON(t, resp, &u)
|
||||
assert.Equal(t, org3.GetPlaceholderEmail(), u.Email)
|
||||
|
||||
// Test if the correct Mail is returned if a User is logged in
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s", org3.Name)).
|
||||
req = NewRequest(t, "GET", "/api/v1/users/"+org3.Name).
|
||||
AddTokenAuth(token)
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
DecodeJSON(t, resp, &u)
|
||||
|
Reference in New Issue
Block a user