summaryrefslogtreecommitdiffstats
path: root/plugin/rpcplugin/api_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/rpcplugin/api_test.go')
-rw-r--r--plugin/rpcplugin/api_test.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/plugin/rpcplugin/api_test.go b/plugin/rpcplugin/api_test.go
index 7fe7a0ff9..d7b3733ea 100644
--- a/plugin/rpcplugin/api_test.go
+++ b/plugin/rpcplugin/api_test.go
@@ -128,11 +128,32 @@ func TestAPI(t *testing.T) {
assert.Equal(t, testChannel, channel)
assert.Nil(t, err)
+ api.On("AddChannelMember", testChannel.Id, "theuserid").Return(testChannelMember, nil).Once()
+ member, err := remote.AddChannelMember(testChannel.Id, "theuserid")
+ assert.Equal(t, testChannelMember, member)
+ assert.Nil(t, err)
+
api.On("GetChannelMember", "thechannelid", "theuserid").Return(testChannelMember, nil).Once()
- member, err := remote.GetChannelMember("thechannelid", "theuserid")
+ member, err = remote.GetChannelMember("thechannelid", "theuserid")
+ assert.Equal(t, testChannelMember, member)
+ assert.Nil(t, err)
+
+ api.On("UpdateChannelMemberRoles", testChannel.Id, "theuserid", model.CHANNEL_ADMIN_ROLE_ID).Return(testChannelMember, nil).Once()
+ member, err = remote.UpdateChannelMemberRoles(testChannel.Id, "theuserid", model.CHANNEL_ADMIN_ROLE_ID)
assert.Equal(t, testChannelMember, member)
assert.Nil(t, err)
+ notifications := map[string]string{}
+ notifications[model.MARK_UNREAD_NOTIFY_PROP] = model.CHANNEL_MARK_UNREAD_MENTION
+ api.On("UpdateChannelMemberNotifications", testChannel.Id, "theuserid", notifications).Return(testChannelMember, nil).Once()
+ member, err = remote.UpdateChannelMemberNotifications(testChannel.Id, "theuserid", notifications)
+ assert.Equal(t, testChannelMember, member)
+ assert.Nil(t, err)
+
+ api.On("DeleteChannelMember", "thechannelid", "theuserid").Return(nil).Once()
+ err = remote.DeleteChannelMember("thechannelid", "theuserid")
+ assert.Nil(t, err)
+
api.On("CreateUser", mock.AnythingOfType("*model.User")).Return(func(u *model.User) (*model.User, *model.AppError) {
u.Id = "theuserid"
return u, nil