summaryrefslogtreecommitdiffstats
path: root/plugin/rpcplugin/api_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-12-08 13:55:41 -0600
committerGitHub <noreply@github.com>2017-12-08 13:55:41 -0600
commit4c17bdff1bb871fb31520b7b547f584c53ed854f (patch)
treeedf1e3295d6ff7d67281efc585b2e913b4efda3d /plugin/rpcplugin/api_test.go
parent7ed1177a2b676aa4c93515268642c855cfe57a37 (diff)
downloadchat-4c17bdff1bb871fb31520b7b547f584c53ed854f.tar.gz
chat-4c17bdff1bb871fb31520b7b547f584c53ed854f.tar.bz2
chat-4c17bdff1bb871fb31520b7b547f584c53ed854f.zip
Add plugin slash command support (#7941)
* add plugin slash command support * remove unused string * rebase
Diffstat (limited to 'plugin/rpcplugin/api_test.go')
-rw-r--r--plugin/rpcplugin/api_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugin/rpcplugin/api_test.go b/plugin/rpcplugin/api_test.go
index f9e474d4a..145ec9005 100644
--- a/plugin/rpcplugin/api_test.go
+++ b/plugin/rpcplugin/api_test.go
@@ -2,6 +2,7 @@ package rpcplugin
import (
"encoding/json"
+ "fmt"
"io"
"net/http"
"testing"
@@ -84,6 +85,16 @@ func TestAPI(t *testing.T) {
assert.Equal(t, "foo", config.Foo)
assert.Equal(t, "baz", config.Bar.Baz)
+ api.On("RegisterCommand", mock.AnythingOfType("*model.Command")).Return(fmt.Errorf("foo")).Once()
+ assert.Error(t, remote.RegisterCommand(&model.Command{}))
+ api.On("RegisterCommand", mock.AnythingOfType("*model.Command")).Return(nil).Once()
+ assert.NoError(t, remote.RegisterCommand(&model.Command{}))
+
+ api.On("UnregisterCommand", "team", "trigger").Return(fmt.Errorf("foo")).Once()
+ assert.Error(t, remote.UnregisterCommand("team", "trigger"))
+ api.On("UnregisterCommand", "team", "trigger").Return(nil).Once()
+ assert.NoError(t, remote.UnregisterCommand("team", "trigger"))
+
api.On("CreateChannel", mock.AnythingOfType("*model.Channel")).Return(func(c *model.Channel) (*model.Channel, *model.AppError) {
c.Id = "thechannelid"
return c, nil