[MM-27170] Migrate verify user by id endpoint to local mode (#15091)
* [MM-27170] Migrate verify user by id endpoint to local mode * Update api4/user_test.go Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com> Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
14aba9bccb
Коммит
6b5c0bb5d2
@@ -24,6 +24,7 @@ func (api *API) InitUserLocal() {
|
||||
api.BaseRoutes.User.Handle("/mfa", api.ApiLocal(updateUserMfa)).Methods("PUT")
|
||||
api.BaseRoutes.User.Handle("/active", api.ApiLocal(updateUserActive)).Methods("PUT")
|
||||
api.BaseRoutes.User.Handle("/convert_to_bot", api.ApiLocal(convertUserToBot)).Methods("POST")
|
||||
api.BaseRoutes.User.Handle("/email/verify/member", api.ApiLocal(verifyUserEmailWithoutToken)).Methods("POST")
|
||||
|
||||
api.BaseRoutes.UserByUsername.Handle("", api.ApiLocal(localGetUserByUsername)).Methods("GET")
|
||||
api.BaseRoutes.UserByEmail.Handle("", api.ApiLocal(localGetUserByEmail)).Methods("GET")
|
||||
|
||||
@@ -4913,22 +4913,22 @@ func TestVerifyUserEmailWithoutToken(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("Should verify a new user", func(t *testing.T) {
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
email := th.GenerateTestEmail()
|
||||
user := model.User{Email: email, Nickname: "Darth Vader", Password: "hello1", Username: GenerateTestUsername(), Roles: model.SYSTEM_USER_ROLE_ID}
|
||||
ruser, _ := th.Client.CreateUser(&user)
|
||||
|
||||
vuser, resp := th.SystemAdminClient.VerifyUserEmailWithoutToken(ruser.Id)
|
||||
vuser, resp := client.VerifyUserEmailWithoutToken(ruser.Id)
|
||||
require.Nil(t, resp.Error)
|
||||
require.Equal(t, ruser.Id, vuser.Id)
|
||||
})
|
||||
}, "Should verify a new user")
|
||||
|
||||
t.Run("Should not be able to find user", func(t *testing.T) {
|
||||
vuser, resp := th.SystemAdminClient.VerifyUserEmailWithoutToken("randomId")
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
vuser, resp := client.VerifyUserEmailWithoutToken("randomId")
|
||||
require.NotNil(t, resp.Error)
|
||||
CheckErrorMessage(t, resp, "api.context.invalid_url_param.app_error")
|
||||
require.Nil(t, vuser)
|
||||
})
|
||||
}, "Should not be able to find user")
|
||||
|
||||
t.Run("Should not be able to verify user due to permissions", func(t *testing.T) {
|
||||
user := th.CreateUser()
|
||||
|
||||
Ссылка в новой задаче
Block a user