mirror of
https://github.com/go-gitea/gitea
synced 2025-07-05 18:17:19 +00:00
@ -31,7 +31,8 @@ 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?token=%s", user2, token))
|
||||
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s", user2)).
|
||||
AddTokenAuth(token)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var u api.User
|
||||
@ -48,7 +49,8 @@ func TestAPIUserInfo(t *testing.T) {
|
||||
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?token=%s", org3.Name, token))
|
||||
req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/users/%s", org3.Name)).
|
||||
AddTokenAuth(token)
|
||||
resp = MakeRequest(t, req, http.StatusOK)
|
||||
DecodeJSON(t, resp, &u)
|
||||
assert.Equal(t, org3.GetEmail(), u.Email)
|
||||
@ -57,7 +59,8 @@ func TestAPIUserInfo(t *testing.T) {
|
||||
t.Run("GetAuthenticatedUser", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", fmt.Sprintf("/api/v1/user?token=%s", token))
|
||||
req := NewRequest(t, "GET", "/api/v1/user").
|
||||
AddTokenAuth(token)
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
var u api.User
|
||||
|
Reference in New Issue
Block a user