summaryrefslogtreecommitdiffstats
path: root/plugin/plugintest
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-08-20 18:22:08 +0200
committerChristopher Speller <crspeller@gmail.com>2018-08-20 09:22:08 -0700
commitcea1796f0698956e4fab57a0015b292854bbbcf3 (patch)
tree6a1adcdf154d3307cba3d670b9a94ba4e39cc0f8 /plugin/plugintest
parent56d92de3f20fa1d89c2d2c09b03e933a1325af8b (diff)
downloadchat-cea1796f0698956e4fab57a0015b292854bbbcf3.tar.gz
chat-cea1796f0698956e4fab57a0015b292854bbbcf3.tar.bz2
chat-cea1796f0698956e4fab57a0015b292854bbbcf3.zip
Adding Permissions check and reactions function to plugins API (#9273)
* Adding reactions functions * Adding permissions checking in the plugins api
Diffstat (limited to 'plugin/plugintest')
-rw-r--r--plugin/plugintest/api.go108
1 files changed, 108 insertions, 0 deletions
diff --git a/plugin/plugintest/api.go b/plugin/plugintest/api.go
index 3c2716778..e84ceffd8 100644
--- a/plugin/plugintest/api.go
+++ b/plugin/plugintest/api.go
@@ -37,6 +37,31 @@ func (_m *API) AddChannelMember(channelId string, userId string) (*model.Channel
return r0, r1
}
+// AddReaction provides a mock function with given fields: reaction
+func (_m *API) AddReaction(reaction *model.Reaction) (*model.Reaction, *model.AppError) {
+ ret := _m.Called(reaction)
+
+ var r0 *model.Reaction
+ if rf, ok := ret.Get(0).(func(*model.Reaction) *model.Reaction); ok {
+ r0 = rf(reaction)
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).(*model.Reaction)
+ }
+ }
+
+ var r1 *model.AppError
+ if rf, ok := ret.Get(1).(func(*model.Reaction) *model.AppError); ok {
+ r1 = rf(reaction)
+ } else {
+ if ret.Get(1) != nil {
+ r1 = ret.Get(1).(*model.AppError)
+ }
+ }
+
+ return r0, r1
+}
+
// CopyFileInfos provides a mock function with given fields: userId, fileIds
func (_m *API) CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError) {
ret := _m.Called(userId, fileIds)
@@ -549,6 +574,31 @@ func (_m *API) GetPublicChannelsForTeam(teamId string, offset int, limit int) (*
return r0, r1
}
+// GetReactions provides a mock function with given fields: postId
+func (_m *API) GetReactions(postId string) ([]*model.Reaction, *model.AppError) {
+ ret := _m.Called(postId)
+
+ var r0 []*model.Reaction
+ if rf, ok := ret.Get(0).(func(string) []*model.Reaction); ok {
+ r0 = rf(postId)
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).([]*model.Reaction)
+ }
+ }
+
+ var r1 *model.AppError
+ if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
+ r1 = rf(postId)
+ } else {
+ if ret.Get(1) != nil {
+ r1 = ret.Get(1).(*model.AppError)
+ }
+ }
+
+ return r0, r1
+}
+
// GetSession provides a mock function with given fields: sessionId
func (_m *API) GetSession(sessionId string) (*model.Session, *model.AppError) {
ret := _m.Called(sessionId)
@@ -824,6 +874,48 @@ func (_m *API) GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.A
return r0, r1
}
+// HasPermissionTo provides a mock function with given fields: userId, permission
+func (_m *API) HasPermissionTo(userId string, permission *model.Permission) bool {
+ ret := _m.Called(userId, permission)
+
+ var r0 bool
+ if rf, ok := ret.Get(0).(func(string, *model.Permission) bool); ok {
+ r0 = rf(userId, permission)
+ } else {
+ r0 = ret.Get(0).(bool)
+ }
+
+ return r0
+}
+
+// HasPermissionToChannel provides a mock function with given fields: userId, channelId, permission
+func (_m *API) HasPermissionToChannel(userId string, channelId string, permission *model.Permission) bool {
+ ret := _m.Called(userId, channelId, permission)
+
+ var r0 bool
+ if rf, ok := ret.Get(0).(func(string, string, *model.Permission) bool); ok {
+ r0 = rf(userId, channelId, permission)
+ } else {
+ r0 = ret.Get(0).(bool)
+ }
+
+ return r0
+}
+
+// HasPermissionToTeam provides a mock function with given fields: userId, teamId, permission
+func (_m *API) HasPermissionToTeam(userId string, teamId string, permission *model.Permission) bool {
+ ret := _m.Called(userId, teamId, permission)
+
+ var r0 bool
+ if rf, ok := ret.Get(0).(func(string, string, *model.Permission) bool); ok {
+ r0 = rf(userId, teamId, permission)
+ } else {
+ r0 = ret.Get(0).(bool)
+ }
+
+ return r0
+}
+
// KVDelete provides a mock function with given fields: key
func (_m *API) KVDelete(key string) *model.AppError {
ret := _m.Called(key)
@@ -971,6 +1063,22 @@ func (_m *API) RegisterCommand(command *model.Command) error {
return r0
}
+// RemoveReaction provides a mock function with given fields: reaction
+func (_m *API) RemoveReaction(reaction *model.Reaction) *model.AppError {
+ ret := _m.Called(reaction)
+
+ var r0 *model.AppError
+ if rf, ok := ret.Get(0).(func(*model.Reaction) *model.AppError); ok {
+ r0 = rf(reaction)
+ } else {
+ if ret.Get(0) != nil {
+ r0 = ret.Get(0).(*model.AppError)
+ }
+ }
+
+ return r0
+}
+
// SaveConfig provides a mock function with given fields: config
func (_m *API) SaveConfig(config *model.Config) *model.AppError {
ret := _m.Called(config)