summaryrefslogtreecommitdiffstats
path: root/api/command_echo_test.go
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-01-08 12:41:26 -0600
committer=Corey Hulen <corey@hulen.com>2016-01-08 12:41:26 -0600
commit3fba8e42b140c1189bf3c06882cce5e2231e63da (patch)
tree7a0721cecf6624fc9c1fd71449628472b941ddeb /api/command_echo_test.go
parent001a4448ca5fb0018eeb442915b473b121c04bf3 (diff)
downloadchat-3fba8e42b140c1189bf3c06882cce5e2231e63da.tar.gz
chat-3fba8e42b140c1189bf3c06882cce5e2231e63da.tar.bz2
chat-3fba8e42b140c1189bf3c06882cce5e2231e63da.zip
partial fix for UI
Diffstat (limited to 'api/command_echo_test.go')
-rw-r--r--api/command_echo_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/api/command_echo_test.go b/api/command_echo_test.go
new file mode 100644
index 000000000..40a0bb4b9
--- /dev/null
+++ b/api/command_echo_test.go
@@ -0,0 +1,42 @@
+// Copyright (c) 2015 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 TestEchoCommand(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)
+
+ echoTestString := "/echo test"
+
+ r1 := Client.Must(Client.Command(channel1.Id, echoTestString, false)).Data.(*model.CommandResponse)
+ if r1 == nil {
+ t.Fatal("Echo 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("Echo command failed to send")
+ }
+}