summaryrefslogtreecommitdiffstats
path: root/tests/integration/api_user_update_test.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-04-18 11:16:20 +0800
committerGitHub <noreply@github.com>2024-04-18 03:16:20 +0000
commit2da1dcfc21afe6f5373e4271e9ddcc7f31d6695b (patch)
treea1480dba2fa7e79bff4e7a713ef305e368ba3e0d /tests/integration/api_user_update_test.go
parentffc98790703cdc41ed2327e613aa2f91a051b457 (diff)
downloadgitea-2da1dcfc21afe6f5373e4271e9ddcc7f31d6695b.tar.gz
gitea-2da1dcfc21afe6f5373e4271e9ddcc7f31d6695b.zip
Add an api test for updating user (#30539)
Fix #30518
Diffstat (limited to 'tests/integration/api_user_update_test.go')
-rw-r--r--tests/integration/api_user_update_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/integration/api_user_update_test.go b/tests/integration/api_user_update_test.go
new file mode 100644
index 0000000000..af5481cfd5
--- /dev/null
+++ b/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)
+}