code.gitea.io/gitea@v1.22.3/tests/integration/api_user_update_test.go (about)

     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  }