Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an api test for updating user #30539

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}