diff options
author | JoramWilander <jwawilander@gmail.com> | 2018-03-08 07:19:50 -0500 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2018-03-08 07:19:50 -0500 |
commit | 8010cef1d955aecd4ac33bcb8cba4e424dfa8f88 (patch) | |
tree | 56faac3e5f1da43d3b40e4f6a8f86a264cb04915 /plugin/rpcplugin/api_test.go | |
parent | 4081bb2a71f93b84ab228900e85b32413574195b (diff) | |
parent | 98e1231fcc6f12eedad2d5fd7a28bf9d349dd853 (diff) | |
download | chat-8010cef1d955aecd4ac33bcb8cba4e424dfa8f88.tar.gz chat-8010cef1d955aecd4ac33bcb8cba4e424dfa8f88.tar.bz2 chat-8010cef1d955aecd4ac33bcb8cba4e424dfa8f88.zip |
Merge branch 'release-4.8' into merge-4.8
Diffstat (limited to 'plugin/rpcplugin/api_test.go')
-rw-r--r-- | plugin/rpcplugin/api_test.go | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/plugin/rpcplugin/api_test.go b/plugin/rpcplugin/api_test.go index 145ec9005..7fe7a0ff9 100644 --- a/plugin/rpcplugin/api_test.go +++ b/plugin/rpcplugin/api_test.go @@ -72,11 +72,6 @@ func TestAPI(t *testing.T) { testPost := &model.Post{ Message: "hello", - Props: map[string]interface{}{ - "attachments": []*model.SlackAttachment{ - &model.SlackAttachment{}, - }, - }, } testAPIRPC(&api, func(remote plugin.API) { @@ -244,3 +239,41 @@ func TestAPI(t *testing.T) { assert.Nil(t, err) }) } + +func TestAPI_GobRegistration(t *testing.T) { + keyValueStore := &plugintest.KeyValueStore{} + api := plugintest.API{Store: keyValueStore} + defer api.AssertExpectations(t) + + testAPIRPC(&api, func(remote plugin.API) { + api.On("CreatePost", mock.AnythingOfType("*model.Post")).Return(func(p *model.Post) (*model.Post, *model.AppError) { + p.Id = "thepostid" + return p, nil + }).Once() + _, err := remote.CreatePost(&model.Post{ + Message: "hello", + Props: map[string]interface{}{ + "attachments": []*model.SlackAttachment{ + &model.SlackAttachment{ + Actions: []*model.PostAction{ + &model.PostAction{ + Integration: &model.PostActionIntegration{ + Context: map[string]interface{}{ + "foo": "bar", + "foos": []interface{}{"bar", "baz", 1, 2}, + "foo_map": map[string]interface{}{ + "1": "bar", + "2": 2, + }, + }, + }, + }, + }, + Timestamp: 1, + }, + }, + }, + }) + require.Nil(t, err) + }) +} |