github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/api/command_help_test.go (about) 1 // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package api 5 6 import ( 7 "testing" 8 9 "github.com/mattermost/mattermost-server/model" 10 ) 11 12 func TestHelpCommand(t *testing.T) { 13 th := Setup().InitBasic() 14 defer th.TearDown() 15 16 Client := th.BasicClient 17 channel := th.BasicChannel 18 19 HelpLink := *th.App.Config().SupportSettings.HelpLink 20 defer func() { 21 th.App.UpdateConfig(func(cfg *model.Config) { *cfg.SupportSettings.HelpLink = HelpLink }) 22 }() 23 24 th.App.UpdateConfig(func(cfg *model.Config) { *cfg.SupportSettings.HelpLink = "" }) 25 rs1 := Client.Must(Client.Command(channel.Id, "/help ")).Data.(*model.CommandResponse) 26 if rs1.GotoLocation != model.SUPPORT_SETTINGS_DEFAULT_HELP_LINK { 27 t.Fatal("failed to default help link") 28 } 29 30 th.App.UpdateConfig(func(cfg *model.Config) { 31 *cfg.SupportSettings.HelpLink = "https://docs.mattermost.com/guides/user.html" 32 }) 33 rs2 := Client.Must(Client.Command(channel.Id, "/help ")).Data.(*model.CommandResponse) 34 if rs2.GotoLocation != "https://docs.mattermost.com/guides/user.html" { 35 t.Fatal("failed to help link") 36 } 37 }