Skip to content

Commit

Permalink
Add an api test for updating user (#30539)
Browse files Browse the repository at this point in the history
Fix #30518
  • Loading branch information
lunny authored and pull[bot] committed Apr 27, 2024
1 parent 664b32b commit a3eb339
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/integration/api_user_update_test.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit a3eb339

Please sign in to comment.