summaryrefslogtreecommitdiffstats
path: root/api/command_shrug_test.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-02-04 10:55:44 -0800
committer=Corey Hulen <corey@hulen.com>2016-02-04 10:55:44 -0800
commitcfd4e4de963703191e750ba0abb901c5f6c0c3e4 (patch)
treed01a656eeeaba9603568a54a164f378608c4a939 /api/command_shrug_test.go
parentf1bf70624288bd192b9523764f239eee2a022304 (diff)
parent44c19ee443831e0e94b5738ecb21a64ce7643247 (diff)
downloadchat-cfd4e4de963703191e750ba0abb901c5f6c0c3e4.tar.gz
chat-cfd4e4de963703191e750ba0abb901c5f6c0c3e4.tar.bz2
chat-cfd4e4de963703191e750ba0abb901c5f6c0c3e4.zip
Merge branch 'master' into PLT-1851
Diffstat (limited to 'api/command_shrug_test.go')
-rw-r--r--api/command_shrug_test.go47
1 files changed, 47 insertions, 0 deletions
diff --git a/api/command_shrug_test.go b/api/command_shrug_test.go
new file mode 100644
index 000000000..92cecf664
--- /dev/null
+++ b/api/command_shrug_test.go
@@ -0,0 +1,47 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package api
+
+import (
+ "testing"
+ "time"
+
+ "github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/store"
+)
+
+func TestShrugCommand(t *testing.T) {
+ Setup()
+
+ team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
+ team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
+
+ user1 := &model.User{TeamId: team.Id, Email: model.NewId() + "corey+test@test.com", Nickname: "Corey Hulen", Password: "pwd"}
+ user1 = Client.Must(Client.CreateUser(user1, "")).Data.(*model.User)
+ store.Must(Srv.Store.User().VerifyEmail(user1.Id))
+
+ Client.LoginByEmail(team.Name, user1.Email, "pwd")
+
+ channel1 := &model.Channel{DisplayName: "AA", Name: "aa" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
+ channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
+
+ testString := "/shrug"
+
+ r1 := Client.Must(Client.Command(channel1.Id, testString, false)).Data.(*model.CommandResponse)
+ if r1 == nil {
+ t.Fatal("Command failed to execute")
+ }
+
+ time.Sleep(100 * time.Millisecond)
+
+ p1 := Client.Must(Client.GetPosts(channel1.Id, 0, 2, "")).Data.(*model.PostList)
+ if len(p1.Order) != 1 {
+ t.Fatal("Command failed to send")
+ } else {
+ if p1.Posts[p1.Order[0]].Message != `¯\\\_(ツ)\_/¯` {
+ t.Log(p1.Posts[p1.Order[0]].Message)
+ t.Fatal("invalid shrug reponse")
+ }
+ }
+}