[MM-25648] api4: add user/bot convert endpoints (#14877)

* api4: add user/bot convert endpoints

* api4: add convert user/bot to local mode

* api4: fix linting issues

* api4/bot: reflect review comments

* api4: update convert user endpoint paths

* remove shadow decl

* fix translation problems
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2020-07-17 10:00:43 +03:00
коммит произвёл GitHub
родитель cb89c53dcc
Коммит 6a4e3293f8
11 изменённых файлов: 258 добавлений и 0 удалений

Просмотреть файл

@@ -5075,3 +5075,29 @@ func TestPublishUserTyping(t *testing.T) {
CheckServiceUnavailableStatus(t, resp)
})
}
func TestConvertUserToBot(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
bot, resp := th.Client.ConvertUserToBot(th.BasicUser.Id)
CheckForbiddenStatus(t, resp)
require.Nil(t, bot)
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
user := model.User{Email: th.GenerateTestEmail(), Username: GenerateTestUsername(), Password: "password"}
ruser, resp := client.CreateUser(&user)
CheckNoError(t, resp)
CheckCreatedStatus(t, resp)
bot, resp = client.ConvertUserToBot(ruser.Id)
CheckNoError(t, resp)
require.NotNil(t, bot)
require.Equal(t, bot.UserId, ruser.Id)
bot, resp = client.GetBot(bot.UserId, "")
CheckNoError(t, resp)
require.NotNil(t, bot)
})
}