mirror of
https://github.com/mattermost/mattermost.git
synced 2026-05-28 04:35:04 -04:00
Merge dd3d863e48 into 7e75035cb6
This commit is contained in:
commit
28fe8bdf72
2 changed files with 10 additions and 4 deletions
|
|
@ -27,7 +27,6 @@ var CreateBotCmd = &cobra.Command{
|
|||
Short: "Create bot",
|
||||
Long: "Create bot.",
|
||||
Example: ` bot create testbot`,
|
||||
PreRun: disableLocalPrecheck,
|
||||
RunE: withClient(botCreateCmdF),
|
||||
Args: cobra.ExactArgs(1),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -401,20 +401,27 @@ func (s *MmctlE2ETestSuite) TestBotCreateCmdF() {
|
|||
s.th.App.UpdateConfig(func(c *model.Config) { *c.ServiceSettings.EnableBotAccountCreation = true })
|
||||
defer s.th.App.UpdateConfig(func(c *model.Config) { *c.ServiceSettings.EnableBotAccountCreation = createBots })
|
||||
|
||||
s.Run("MM-T3941 Create Bot with an access token", func() {
|
||||
s.Run("Create Bot with an access token without permission", func() {
|
||||
printer.Clean()
|
||||
|
||||
cmd := &cobra.Command{}
|
||||
cmd.Flags().Bool("with-token", true, "")
|
||||
|
||||
err := botCreateCmdF(s.th.Client, cmd, []string{"testbot"})
|
||||
username := model.NewUsername()
|
||||
err := botCreateCmdF(s.th.Client, cmd, []string{username})
|
||||
s.Require().Error(err)
|
||||
s.Require().Contains(err.Error(), "permissions")
|
||||
s.Require().Empty(printer.GetLines())
|
||||
s.Require().Empty(printer.GetErrorLines())
|
||||
})
|
||||
|
||||
s.RunForSystemAdminAndLocal("MM-T3941 Create Bot with an access token", func(c client.Client) {
|
||||
printer.Clean()
|
||||
|
||||
err = botCreateCmdF(s.th.SystemAdminClient, cmd, []string{"testbot"})
|
||||
cmd := &cobra.Command{}
|
||||
cmd.Flags().Bool("with-token", true, "")
|
||||
|
||||
err := botCreateCmdF(c, cmd, []string{model.NewUsername()})
|
||||
s.Require().NoError(err)
|
||||
s.Require().Equal(2, len(printer.GetLines()))
|
||||
bot, ok := printer.GetLines()[0].(*model.Bot)
|
||||
|
|
|
|||
Loading…
Reference in a new issue