Automatic Merge
Этот коммит содержится в:
@@ -6673,6 +6673,34 @@ func TestDemoteUserToGuest(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("cannot demote bot account", func(t *testing.T) {
|
||||
th.App.Srv().SetLicense(model.NewTestLicense("guest_accounts"))
|
||||
|
||||
prevBotCreation := *th.App.Config().ServiceSettings.EnableBotAccountCreation
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.EnableBotAccountCreation = true
|
||||
})
|
||||
defer th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.EnableBotAccountCreation = prevBotCreation
|
||||
})
|
||||
|
||||
createdBot, resp, err := th.SystemAdminClient.CreateBot(context.Background(), &model.Bot{
|
||||
Username: "botdemote" + model.NewId(),
|
||||
DisplayName: "Demote Test Bot",
|
||||
Description: "test",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
CheckCreatedStatus(t, resp)
|
||||
defer func() {
|
||||
appErr := th.App.PermanentDeleteBot(th.Context, createdBot.UserId)
|
||||
require.Nil(t, appErr)
|
||||
}()
|
||||
|
||||
demoteResp, err := th.SystemAdminClient.DemoteUserToGuest(context.Background(), createdBot.UserId)
|
||||
CheckBadRequestStatus(t, demoteResp)
|
||||
CheckErrorID(t, err, "api.user.demote_user_to_guest.bot_not_allowed.app_error")
|
||||
})
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, c *model.Client4) {
|
||||
_, _, err := c.GetUser(context.Background(), user.Id, "")
|
||||
require.NoError(t, err)
|
||||
|
||||
Ссылка в новой задаче
Block a user