Skip to content

Commit 2da1dcf

Browse files
authored
Add an api test for updating user (#30539)
Fix #30518
1 parent ffc9879 commit 2da1dcf

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2024 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package integration
5+
6+
import (
7+
"net/http"
8+
"testing"
9+
10+
auth_model "code.gitea.io/gitea/models/auth"
11+
"code.gitea.io/gitea/tests"
12+
)
13+
14+
func TestAPIUpdateUser(t *testing.T) {
15+
defer tests.PrepareTestEnv(t)()
16+
17+
normalUsername := "user2"
18+
session := loginUser(t, normalUsername)
19+
token := getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteUser)
20+
21+
req := NewRequestWithJSON(t, "PATCH", "/api/v1/user/settings", map[string]string{
22+
"website": "https://gitea.com",
23+
}).AddTokenAuth(token)
24+
MakeRequest(t, req, http.StatusOK)
25+
}

0 commit comments

Comments
 (0)