github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/app/command_msg_test.go (about) 1 // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package app 5 6 import ( 7 "testing" 8 9 "github.com/nicksnyder/go-i18n/i18n" 10 "github.com/stretchr/testify/assert" 11 12 "github.com/mattermost/mattermost-server/model" 13 ) 14 15 func TestMsgProvider(t *testing.T) { 16 th := Setup().InitBasic() 17 defer th.TearDown() 18 19 team := th.CreateTeam() 20 th.LinkUserToTeam(th.BasicUser, team) 21 cmd := &msgProvider{} 22 resp := cmd.DoCommand(th.App, &model.CommandArgs{ 23 T: i18n.IdentityTfunc(), 24 SiteURL: "http://test.url", 25 TeamId: team.Id, 26 UserId: th.BasicUser.Id, 27 }, "@"+th.BasicUser2.Username+" hello") 28 channelName := model.GetDMNameFromIds(th.BasicUser.Id, th.BasicUser2.Id) 29 assert.Equal(t, "", resp.Text) 30 assert.Equal(t, "http://test.url/"+team.Name+"/channels/"+channelName, resp.GotoLocation) 31 }