diff options
Diffstat (limited to 'plugin/plugintest/api.go')
-rw-r--r-- | plugin/plugintest/api.go | 127 |
1 files changed, 86 insertions, 41 deletions
diff --git a/plugin/plugintest/api.go b/plugin/plugintest/api.go index f1281a5ff..145fcbf9d 100644 --- a/plugin/plugintest/api.go +++ b/plugin/plugintest/api.go @@ -1,4 +1,4 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v1.0.0 // Regenerate this file using `make plugin-mocks`. @@ -6,15 +6,14 @@ package plugintest import mock "github.com/stretchr/testify/mock" import model "github.com/mattermost/mattermost-server/model" -import plugin "github.com/mattermost/mattermost-server/plugin" -// APIMOCKINTERNAL is an autogenerated mock type for the APIMOCKINTERNAL type -type APIMOCKINTERNAL struct { +// API is an autogenerated mock type for the API type +type API struct { mock.Mock } // AddChannelMember provides a mock function with given fields: channelId, userId -func (_m *APIMOCKINTERNAL) AddChannelMember(channelId string, userId string) (*model.ChannelMember, *model.AppError) { +func (_m *API) AddChannelMember(channelId string, userId string) (*model.ChannelMember, *model.AppError) { ret := _m.Called(channelId, userId) var r0 *model.ChannelMember @@ -39,7 +38,7 @@ func (_m *APIMOCKINTERNAL) AddChannelMember(channelId string, userId string) (*m } // CreateChannel provides a mock function with given fields: channel -func (_m *APIMOCKINTERNAL) CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError) { +func (_m *API) CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError) { ret := _m.Called(channel) var r0 *model.Channel @@ -64,7 +63,7 @@ func (_m *APIMOCKINTERNAL) CreateChannel(channel *model.Channel) (*model.Channel } // CreatePost provides a mock function with given fields: post -func (_m *APIMOCKINTERNAL) CreatePost(post *model.Post) (*model.Post, *model.AppError) { +func (_m *API) CreatePost(post *model.Post) (*model.Post, *model.AppError) { ret := _m.Called(post) var r0 *model.Post @@ -89,7 +88,7 @@ func (_m *APIMOCKINTERNAL) CreatePost(post *model.Post) (*model.Post, *model.App } // CreateTeam provides a mock function with given fields: team -func (_m *APIMOCKINTERNAL) CreateTeam(team *model.Team) (*model.Team, *model.AppError) { +func (_m *API) CreateTeam(team *model.Team) (*model.Team, *model.AppError) { ret := _m.Called(team) var r0 *model.Team @@ -114,7 +113,7 @@ func (_m *APIMOCKINTERNAL) CreateTeam(team *model.Team) (*model.Team, *model.App } // CreateUser provides a mock function with given fields: user -func (_m *APIMOCKINTERNAL) CreateUser(user *model.User) (*model.User, *model.AppError) { +func (_m *API) CreateUser(user *model.User) (*model.User, *model.AppError) { ret := _m.Called(user) var r0 *model.User @@ -139,7 +138,7 @@ func (_m *APIMOCKINTERNAL) CreateUser(user *model.User) (*model.User, *model.App } // DeleteChannel provides a mock function with given fields: channelId -func (_m *APIMOCKINTERNAL) DeleteChannel(channelId string) *model.AppError { +func (_m *API) DeleteChannel(channelId string) *model.AppError { ret := _m.Called(channelId) var r0 *model.AppError @@ -155,7 +154,7 @@ func (_m *APIMOCKINTERNAL) DeleteChannel(channelId string) *model.AppError { } // DeleteChannelMember provides a mock function with given fields: channelId, userId -func (_m *APIMOCKINTERNAL) DeleteChannelMember(channelId string, userId string) *model.AppError { +func (_m *API) DeleteChannelMember(channelId string, userId string) *model.AppError { ret := _m.Called(channelId, userId) var r0 *model.AppError @@ -171,7 +170,7 @@ func (_m *APIMOCKINTERNAL) DeleteChannelMember(channelId string, userId string) } // DeletePost provides a mock function with given fields: postId -func (_m *APIMOCKINTERNAL) DeletePost(postId string) *model.AppError { +func (_m *API) DeletePost(postId string) *model.AppError { ret := _m.Called(postId) var r0 *model.AppError @@ -187,7 +186,7 @@ func (_m *APIMOCKINTERNAL) DeletePost(postId string) *model.AppError { } // DeleteTeam provides a mock function with given fields: teamId -func (_m *APIMOCKINTERNAL) DeleteTeam(teamId string) *model.AppError { +func (_m *API) DeleteTeam(teamId string) *model.AppError { ret := _m.Called(teamId) var r0 *model.AppError @@ -203,7 +202,7 @@ func (_m *APIMOCKINTERNAL) DeleteTeam(teamId string) *model.AppError { } // DeleteUser provides a mock function with given fields: userId -func (_m *APIMOCKINTERNAL) DeleteUser(userId string) *model.AppError { +func (_m *API) DeleteUser(userId string) *model.AppError { ret := _m.Called(userId) var r0 *model.AppError @@ -219,7 +218,7 @@ func (_m *APIMOCKINTERNAL) DeleteUser(userId string) *model.AppError { } // GetChannel provides a mock function with given fields: channelId -func (_m *APIMOCKINTERNAL) GetChannel(channelId string) (*model.Channel, *model.AppError) { +func (_m *API) GetChannel(channelId string) (*model.Channel, *model.AppError) { ret := _m.Called(channelId) var r0 *model.Channel @@ -244,7 +243,7 @@ func (_m *APIMOCKINTERNAL) GetChannel(channelId string) (*model.Channel, *model. } // GetChannelByName provides a mock function with given fields: name, teamId -func (_m *APIMOCKINTERNAL) GetChannelByName(name string, teamId string) (*model.Channel, *model.AppError) { +func (_m *API) GetChannelByName(name string, teamId string) (*model.Channel, *model.AppError) { ret := _m.Called(name, teamId) var r0 *model.Channel @@ -269,7 +268,7 @@ func (_m *APIMOCKINTERNAL) GetChannelByName(name string, teamId string) (*model. } // GetChannelMember provides a mock function with given fields: channelId, userId -func (_m *APIMOCKINTERNAL) GetChannelMember(channelId string, userId string) (*model.ChannelMember, *model.AppError) { +func (_m *API) GetChannelMember(channelId string, userId string) (*model.ChannelMember, *model.AppError) { ret := _m.Called(channelId, userId) var r0 *model.ChannelMember @@ -294,7 +293,7 @@ func (_m *APIMOCKINTERNAL) GetChannelMember(channelId string, userId string) (*m } // GetDirectChannel provides a mock function with given fields: userId1, userId2 -func (_m *APIMOCKINTERNAL) GetDirectChannel(userId1 string, userId2 string) (*model.Channel, *model.AppError) { +func (_m *API) GetDirectChannel(userId1 string, userId2 string) (*model.Channel, *model.AppError) { ret := _m.Called(userId1, userId2) var r0 *model.Channel @@ -319,7 +318,7 @@ func (_m *APIMOCKINTERNAL) GetDirectChannel(userId1 string, userId2 string) (*mo } // GetGroupChannel provides a mock function with given fields: userIds -func (_m *APIMOCKINTERNAL) GetGroupChannel(userIds []string) (*model.Channel, *model.AppError) { +func (_m *API) GetGroupChannel(userIds []string) (*model.Channel, *model.AppError) { ret := _m.Called(userIds) var r0 *model.Channel @@ -344,7 +343,7 @@ func (_m *APIMOCKINTERNAL) GetGroupChannel(userIds []string) (*model.Channel, *m } // GetPost provides a mock function with given fields: postId -func (_m *APIMOCKINTERNAL) GetPost(postId string) (*model.Post, *model.AppError) { +func (_m *API) GetPost(postId string) (*model.Post, *model.AppError) { ret := _m.Called(postId) var r0 *model.Post @@ -369,7 +368,7 @@ func (_m *APIMOCKINTERNAL) GetPost(postId string) (*model.Post, *model.AppError) } // GetTeam provides a mock function with given fields: teamId -func (_m *APIMOCKINTERNAL) GetTeam(teamId string) (*model.Team, *model.AppError) { +func (_m *API) GetTeam(teamId string) (*model.Team, *model.AppError) { ret := _m.Called(teamId) var r0 *model.Team @@ -394,7 +393,7 @@ func (_m *APIMOCKINTERNAL) GetTeam(teamId string) (*model.Team, *model.AppError) } // GetTeamByName provides a mock function with given fields: name -func (_m *APIMOCKINTERNAL) GetTeamByName(name string) (*model.Team, *model.AppError) { +func (_m *API) GetTeamByName(name string) (*model.Team, *model.AppError) { ret := _m.Called(name) var r0 *model.Team @@ -419,7 +418,7 @@ func (_m *APIMOCKINTERNAL) GetTeamByName(name string) (*model.Team, *model.AppEr } // GetUser provides a mock function with given fields: userId -func (_m *APIMOCKINTERNAL) GetUser(userId string) (*model.User, *model.AppError) { +func (_m *API) GetUser(userId string) (*model.User, *model.AppError) { ret := _m.Called(userId) var r0 *model.User @@ -444,7 +443,7 @@ func (_m *APIMOCKINTERNAL) GetUser(userId string) (*model.User, *model.AppError) } // GetUserByEmail provides a mock function with given fields: email -func (_m *APIMOCKINTERNAL) GetUserByEmail(email string) (*model.User, *model.AppError) { +func (_m *API) GetUserByEmail(email string) (*model.User, *model.AppError) { ret := _m.Called(email) var r0 *model.User @@ -469,7 +468,7 @@ func (_m *APIMOCKINTERNAL) GetUserByEmail(email string) (*model.User, *model.App } // GetUserByUsername provides a mock function with given fields: name -func (_m *APIMOCKINTERNAL) GetUserByUsername(name string) (*model.User, *model.AppError) { +func (_m *API) GetUserByUsername(name string) (*model.User, *model.AppError) { ret := _m.Called(name) var r0 *model.User @@ -493,16 +492,57 @@ func (_m *APIMOCKINTERNAL) GetUserByUsername(name string) (*model.User, *model.A return r0, r1 } -// KeyValueStore provides a mock function with given fields: -func (_m *APIMOCKINTERNAL) KeyValueStore() plugin.KeyValueStore { - ret := _m.Called() +// KVDelete provides a mock function with given fields: key +func (_m *API) KVDelete(key string) *model.AppError { + ret := _m.Called(key) - var r0 plugin.KeyValueStore - if rf, ok := ret.Get(0).(func() plugin.KeyValueStore); ok { - r0 = rf() + var r0 *model.AppError + if rf, ok := ret.Get(0).(func(string) *model.AppError); ok { + r0 = rf(key) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(plugin.KeyValueStore) + r0 = ret.Get(0).(*model.AppError) + } + } + + return r0 +} + +// KVGet provides a mock function with given fields: key +func (_m *API) KVGet(key string) ([]byte, *model.AppError) { + ret := _m.Called(key) + + var r0 []byte + if rf, ok := ret.Get(0).(func(string) []byte); ok { + r0 = rf(key) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + + var r1 *model.AppError + if rf, ok := ret.Get(1).(func(string) *model.AppError); ok { + r1 = rf(key) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*model.AppError) + } + } + + return r0, r1 +} + +// KVSet provides a mock function with given fields: key, value +func (_m *API) KVSet(key string, value []byte) *model.AppError { + ret := _m.Called(key, value) + + var r0 *model.AppError + if rf, ok := ret.Get(0).(func(string, []byte) *model.AppError); ok { + r0 = rf(key, value) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*model.AppError) } } @@ -510,7 +550,7 @@ func (_m *APIMOCKINTERNAL) KeyValueStore() plugin.KeyValueStore { } // LoadPluginConfiguration provides a mock function with given fields: dest -func (_m *APIMOCKINTERNAL) LoadPluginConfiguration(dest interface{}) error { +func (_m *API) LoadPluginConfiguration(dest interface{}) error { ret := _m.Called(dest) var r0 error @@ -523,8 +563,13 @@ func (_m *APIMOCKINTERNAL) LoadPluginConfiguration(dest interface{}) error { return r0 } +// PublishWebSocketEvent provides a mock function with given fields: event, payload, broadcast +func (_m *API) PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast) { + _m.Called(event, payload, broadcast) +} + // RegisterCommand provides a mock function with given fields: command -func (_m *APIMOCKINTERNAL) RegisterCommand(command *model.Command) error { +func (_m *API) RegisterCommand(command *model.Command) error { ret := _m.Called(command) var r0 error @@ -538,7 +583,7 @@ func (_m *APIMOCKINTERNAL) RegisterCommand(command *model.Command) error { } // UnregisterCommand provides a mock function with given fields: teamId, trigger -func (_m *APIMOCKINTERNAL) UnregisterCommand(teamId string, trigger string) error { +func (_m *API) UnregisterCommand(teamId string, trigger string) error { ret := _m.Called(teamId, trigger) var r0 error @@ -552,7 +597,7 @@ func (_m *APIMOCKINTERNAL) UnregisterCommand(teamId string, trigger string) erro } // UpdateChannel provides a mock function with given fields: channel -func (_m *APIMOCKINTERNAL) UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError) { +func (_m *API) UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError) { ret := _m.Called(channel) var r0 *model.Channel @@ -577,7 +622,7 @@ func (_m *APIMOCKINTERNAL) UpdateChannel(channel *model.Channel) (*model.Channel } // UpdateChannelMemberNotifications provides a mock function with given fields: channelId, userId, notifications -func (_m *APIMOCKINTERNAL) UpdateChannelMemberNotifications(channelId string, userId string, notifications map[string]string) (*model.ChannelMember, *model.AppError) { +func (_m *API) UpdateChannelMemberNotifications(channelId string, userId string, notifications map[string]string) (*model.ChannelMember, *model.AppError) { ret := _m.Called(channelId, userId, notifications) var r0 *model.ChannelMember @@ -602,7 +647,7 @@ func (_m *APIMOCKINTERNAL) UpdateChannelMemberNotifications(channelId string, us } // UpdateChannelMemberRoles provides a mock function with given fields: channelId, userId, newRoles -func (_m *APIMOCKINTERNAL) UpdateChannelMemberRoles(channelId string, userId string, newRoles string) (*model.ChannelMember, *model.AppError) { +func (_m *API) UpdateChannelMemberRoles(channelId string, userId string, newRoles string) (*model.ChannelMember, *model.AppError) { ret := _m.Called(channelId, userId, newRoles) var r0 *model.ChannelMember @@ -627,7 +672,7 @@ func (_m *APIMOCKINTERNAL) UpdateChannelMemberRoles(channelId string, userId str } // UpdatePost provides a mock function with given fields: post -func (_m *APIMOCKINTERNAL) UpdatePost(post *model.Post) (*model.Post, *model.AppError) { +func (_m *API) UpdatePost(post *model.Post) (*model.Post, *model.AppError) { ret := _m.Called(post) var r0 *model.Post @@ -652,7 +697,7 @@ func (_m *APIMOCKINTERNAL) UpdatePost(post *model.Post) (*model.Post, *model.App } // UpdateTeam provides a mock function with given fields: team -func (_m *APIMOCKINTERNAL) UpdateTeam(team *model.Team) (*model.Team, *model.AppError) { +func (_m *API) UpdateTeam(team *model.Team) (*model.Team, *model.AppError) { ret := _m.Called(team) var r0 *model.Team @@ -677,7 +722,7 @@ func (_m *APIMOCKINTERNAL) UpdateTeam(team *model.Team) (*model.Team, *model.App } // UpdateUser provides a mock function with given fields: user -func (_m *APIMOCKINTERNAL) UpdateUser(user *model.User) (*model.User, *model.AppError) { +func (_m *API) UpdateUser(user *model.User) (*model.User, *model.AppError) { ret := _m.Called(user) var r0 *model.User |