Add plugin slash command support (#7941)

* add plugin slash command support

* remove unused string

* rebase
Этот коммит содержится в:
Chris
2017-12-08 13:55:41 -06:00
коммит произвёл GitHub
родитель 7ed1177a2b
Коммит 4c17bdff1b
19 изменённых файлов: 561 добавлений и 39 удалений

Просмотреть файл

@@ -13,6 +13,7 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/plugin"
"github.com/mattermost/mattermost-server/plugin/plugintest"
)
@@ -79,6 +80,17 @@ func TestHooks(t *testing.T) {
body, err := ioutil.ReadAll(resp.Body)
assert.NoError(t, err)
assert.Equal(t, "bar", string(body))
hooks.On("ExecuteCommand", &model.CommandArgs{
Command: "/foo",
}).Return(&model.CommandResponse{
Text: "bar",
}, nil)
commandResponse, appErr := hooks.ExecuteCommand(&model.CommandArgs{
Command: "/foo",
})
assert.Equal(t, "bar", commandResponse.Text)
assert.Nil(t, appErr)
}))
}