mirror of
https://github.com/mattermost/mattermost.git
synced 2026-04-26 00:33:23 -04:00
It was a good decision in hindsight to keep the public module as 0.x because this would have been a breaking change again. https://mattermost.atlassian.net/browse/MM-53032 ```release-note Changed the Go module path from github.com/mattermost/mattermost-server/server/v8 to github.com/mattermost/mattermost/server/v8. For the public facing module, it's path is also changed from github.com/mattermost/mattermost-server/server/public to github.com/mattermost/mattermost/server/public ```
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
package commands
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/mattermost/mattermost/server/v8/cmd/mmctl/printer"
|
|
|
|
"github.com/mattermost/mattermost/server/public/model"
|
|
)
|
|
|
|
func (s *MmctlE2ETestSuite) TestCreateIncomingWebhookCmd() {
|
|
s.SetupTestHelper().InitBasic()
|
|
|
|
s.Run("provided values should be consistent with the created webhook", func() {
|
|
printer.Clean()
|
|
|
|
cmd := &cobra.Command{}
|
|
cmd.Flags().String("channel", s.th.BasicChannel.Id, "")
|
|
cmd.Flags().String("user", s.th.BasicUser2.Username, "")
|
|
cmd.Flags().String("display-name", "webhook-test-1", "")
|
|
cmd.Flags().String("description", "webhook-test-1-desc", "")
|
|
cmd.Flags().Bool("lock-to-channel", true, "")
|
|
|
|
err := createIncomingWebhookCmdF(s.th.SystemAdminClient, cmd, nil)
|
|
s.Require().Nil(err)
|
|
s.Require().Len(printer.GetLines(), 1)
|
|
s.Require().Len(printer.GetErrorLines(), 0)
|
|
|
|
hook := printer.GetLines()[0].(*model.IncomingWebhook)
|
|
s.Require().Equal(s.th.BasicUser2.Id, hook.UserId)
|
|
s.Require().Equal(s.th.BasicChannel.Id, hook.ChannelId)
|
|
s.Require().Equal("webhook-test-1", hook.DisplayName)
|
|
s.Require().Equal("webhook-test-1-desc", hook.Description)
|
|
s.Require().True(hook.ChannelLocked)
|
|
})
|
|
}
|