github.com/mad-app/mattermost-server@v5.11.1+incompatible/api4/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 api4 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.Client 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.ExecuteCommand(channel.Id, "/help ") 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.ExecuteCommand(channel.Id, "/help ") 34 if rs2.GotoLocation != "https://docs.mattermost.com/guides/user.html" { 35 t.Fatal("failed to help link") 36 } 37 }