Add an api test for updating user (#30539)

Fix #30518
pull/30548/head^2
Lunny Xiao 7 months ago committed by GitHub
parent ffc9879070
commit 2da1dcfc21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 25
      tests/integration/api_user_update_test.go

@ -0,0 +1,25 @@
// Copyright 2024 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package integration
import (
"net/http"
"testing"
auth_model "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/tests"
)
func TestAPIUpdateUser(t *testing.T) {
defer tests.PrepareTestEnv(t)()
normalUsername := "user2"
session := loginUser(t, normalUsername)
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteUser)
req := NewRequestWithJSON(t, "PATCH", "/api/v1/user/settings", map[string]string{
"website": "https://gitea.com",
}).AddTokenAuth(token)
MakeRequest(t, req, http.StatusOK)
}
Loading…
Cancel
Save