MM-14722 - Don't let bots create other bot accounts (#10808)

Этот коммит содержится в:
scott lee davis
2019-05-14 13:15:23 -07:00
коммит произвёл Hanzei
родитель 1a4ea94805
Коммит ae951f6449
6 изменённых файлов: 120 добавлений и 0 удалений

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

@@ -755,3 +755,25 @@ func TestPluginAPIKVCompareAndSet(t *testing.T) {
})
}
}
func TestPluginCreateBot(t *testing.T) {
th := Setup(t)
defer th.TearDown()
api := th.SetupPluginAPI()
bot, err := api.CreateBot(&model.Bot{
Username: model.NewRandomString(10),
DisplayName: "bot",
Description: "bot",
})
require.Nil(t, err)
_, err = api.CreateBot(&model.Bot{
Username: model.NewRandomString(10),
OwnerId: bot.UserId,
DisplayName: "bot2",
Description: "bot2",
})
require.NotNil(t, err)
}