diff options
author | Chris <ccbrown112@gmail.com> | 2017-11-01 13:15:31 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-11-01 14:15:31 -0400 |
commit | bd3b7aeeeadb10bf07dcb8cb0c4a879fdd6e6709 (patch) | |
tree | b0d1a16788973ba6552e0c8799e49f2abb7527a2 /app/command_msg_test.go | |
parent | 23e4b4a27d915191dc4f1164c86e26651b379a11 (diff) | |
download | chat-bd3b7aeeeadb10bf07dcb8cb0c4a879fdd6e6709.tar.gz chat-bd3b7aeeeadb10bf07dcb8cb0c4a879fdd6e6709.tar.bz2 chat-bd3b7aeeeadb10bf07dcb8cb0c4a879fdd6e6709.zip |
Fix /msg switching teams (#7753)
* Fix /msg switching teams
* simplify a bit
Diffstat (limited to 'app/command_msg_test.go')
-rw-r--r-- | app/command_msg_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/command_msg_test.go b/app/command_msg_test.go new file mode 100644 index 000000000..22c4d07cf --- /dev/null +++ b/app/command_msg_test.go @@ -0,0 +1,31 @@ +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +package app + +import ( + "testing" + + "github.com/nicksnyder/go-i18n/i18n" + "github.com/stretchr/testify/assert" + + "github.com/mattermost/mattermost-server/model" +) + +func TestMsgProvider(t *testing.T) { + th := Setup().InitBasic() + defer th.TearDown() + + team := th.CreateTeam() + th.LinkUserToTeam(th.BasicUser, team) + cmd := &msgProvider{} + resp := cmd.DoCommand(th.App, &model.CommandArgs{ + T: i18n.IdentityTfunc(), + SiteURL: "http://test.url", + TeamId: team.Id, + UserId: th.BasicUser.Id, + }, "@"+th.BasicUser2.Username+" hello") + channelName := model.GetDMNameFromIds(th.BasicUser.Id, th.BasicUser2.Id) + assert.Equal(t, "", resp.Text) + assert.Equal(t, "http://test.url/"+team.Name+"/channels/"+channelName, resp.GotoLocation) +} |