Fix bots being unable to post when personal access tokens are disabled. (#11105)

Этот коммит содержится в:
Christopher Speller
2019-06-13 11:54:09 -07:00
коммит произвёл GitHub
родитель 729a7ac0ac
Коммит 1ca421472f
5 изменённых файлов: 40 добавлений и 5 удалений

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

@@ -3960,6 +3960,30 @@ func TestUserAccessTokenDisableConfig(t *testing.T) {
CheckNoError(t, resp)
}
func TestUserAccessTokenDisableConfigBotsExcluded(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
th.App.UpdateConfig(func(cfg *model.Config) {
*cfg.ServiceSettings.EnableBotAccountCreation = true
*cfg.ServiceSettings.EnableUserAccessTokens = false
})
bot, resp := th.SystemAdminClient.CreateBot(&model.Bot{
Username: GenerateTestUsername(),
DisplayName: "a bot",
Description: "bot",
})
CheckCreatedStatus(t, resp)
rtoken, resp := th.SystemAdminClient.CreateUserAccessToken(bot.UserId, "test token")
th.Client.AuthToken = rtoken.Token
CheckNoError(t, resp)
_, resp = th.Client.GetMe("")
CheckNoError(t, resp)
}
func TestGetUsersByStatus(t *testing.T) {
th := Setup()
defer th.TearDown()