Documentation ¶
Overview ¶
The plugintest package provides mocks that can be used to test plugins.
The mocks are created using testify's mock package: https://godoc.org/github.com/stretchr/testify/mock
If you need to import the mock package, you can import it with "github.com/mattermost/mattermost-server/v6/plugin/plugintest/mock".
Example ¶
package main import ( "fmt" "io/ioutil" "net/http" "net/http/httptest" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/mattermost/mattermost-server/v6/model" "github.com/mattermost/mattermost-server/v6/plugin" "github.com/mattermost/mattermost-server/v6/plugin/plugintest" ) type HelloUserPlugin struct { plugin.MattermostPlugin } func (p *HelloUserPlugin) ServeHTTP(context *plugin.Context, w http.ResponseWriter, r *http.Request) { userID := r.Header.Get("Mattermost-User-Id") user, err := p.API.GetUser(userID) if err != nil { w.WriteHeader(http.StatusBadRequest) p.API.LogError(err.Error()) return } fmt.Fprintf(w, "Welcome back, %s!", user.Username) } func main() { t := &testing.T{} user := &model.User{ Id: model.NewId(), Username: "billybob", } api := &plugintest.API{} api.On("GetUser", user.Id).Return(user, nil) defer api.AssertExpectations(t) p := &HelloUserPlugin{} p.SetAPI(api) w := httptest.NewRecorder() r := httptest.NewRequest("GET", "/", nil) r.Header.Add("Mattermost-User-Id", user.Id) p.ServeHTTP(&plugin.Context{}, w, r) body, err := ioutil.ReadAll(w.Result().Body) require.NoError(t, err) assert.Equal(t, "Welcome back, billybob!", string(body)) }
Output:
Index ¶
- type API
- func (_m *API) AddChannelMember(channelId string, userID string) (*model.ChannelMember, *model.AppError)
- func (_m *API) AddReaction(reaction *model.Reaction) (*model.Reaction, *model.AppError)
- func (_m *API) AddUserToChannel(channelId string, userID string, asUserId string) (*model.ChannelMember, *model.AppError)
- func (_m *API) CopyFileInfos(userID string, fileIds []string) ([]string, *model.AppError)
- func (_m *API) CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)
- func (_m *API) CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError)
- func (_m *API) CreateChannelSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError)
- func (_m *API) CreateCommand(cmd *model.Command) (*model.Command, error)
- func (_m *API) CreateOAuthApp(app *model.OAuthApp) (*model.OAuthApp, *model.AppError)
- func (_m *API) CreatePost(post *model.Post) (*model.Post, *model.AppError)
- func (_m *API) CreateSession(session *model.Session) (*model.Session, *model.AppError)
- func (_m *API) CreateTeam(team *model.Team) (*model.Team, *model.AppError)
- func (_m *API) CreateTeamMember(teamID string, userID string) (*model.TeamMember, *model.AppError)
- func (_m *API) CreateTeamMembers(teamID string, userIds []string, requestorId string) ([]*model.TeamMember, *model.AppError)
- func (_m *API) CreateTeamMembersGracefully(teamID string, userIds []string, requestorId string) ([]*model.TeamMemberWithError, *model.AppError)
- func (_m *API) CreateUser(user *model.User) (*model.User, *model.AppError)
- func (_m *API) CreateUserAccessToken(token *model.UserAccessToken) (*model.UserAccessToken, *model.AppError)
- func (_m *API) DeleteChannel(channelId string) *model.AppError
- func (_m *API) DeleteChannelMember(channelId string, userID string) *model.AppError
- func (_m *API) DeleteCommand(commandID string) error
- func (_m *API) DeleteEphemeralPost(userID string, postId string)
- func (_m *API) DeleteOAuthApp(appID string) *model.AppError
- func (_m *API) DeletePost(postId string) *model.AppError
- func (_m *API) DeletePreferencesForUser(userID string, preferences []model.Preference) *model.AppError
- func (_m *API) DeleteTeam(teamID string) *model.AppError
- func (_m *API) DeleteTeamMember(teamID string, userID string, requestorId string) *model.AppError
- func (_m *API) DeleteUser(userID string) *model.AppError
- func (_m *API) DisablePlugin(id string) *model.AppError
- func (_m *API) EnablePlugin(id string) *model.AppError
- func (_m *API) ExecuteSlashCommand(commandArgs *model.CommandArgs) (*model.CommandResponse, error)
- func (_m *API) ExtendSessionExpiry(sessionID string, newExpiry int64) *model.AppError
- func (_m *API) GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError)
- func (_m *API) GetBots(options *model.BotGetOptions) ([]*model.Bot, *model.AppError)
- func (_m *API) GetBundlePath() (string, error)
- func (_m *API) GetChannel(channelId string) (*model.Channel, *model.AppError)
- func (_m *API) GetChannelByName(teamID string, name string, includeDeleted bool) (*model.Channel, *model.AppError)
- func (_m *API) GetChannelByNameForTeamName(teamName string, channelName string, includeDeleted bool) (*model.Channel, *model.AppError)
- func (_m *API) GetChannelMember(channelId string, userID string) (*model.ChannelMember, *model.AppError)
- func (_m *API) GetChannelMembers(channelId string, page int, perPage int) (model.ChannelMembers, *model.AppError)
- func (_m *API) GetChannelMembersByIds(channelId string, userIds []string) (model.ChannelMembers, *model.AppError)
- func (_m *API) GetChannelMembersForUser(teamID string, userID string, page int, perPage int) ([]*model.ChannelMember, *model.AppError)
- func (_m *API) GetChannelSidebarCategories(userID string, teamID string) (*model.OrderedSidebarCategories, *model.AppError)
- func (_m *API) GetChannelStats(channelId string) (*model.ChannelStats, *model.AppError)
- func (_m *API) GetChannelsForTeamForUser(teamID string, userID string, includeDeleted bool) ([]*model.Channel, *model.AppError)
- func (_m *API) GetCommand(commandID string) (*model.Command, error)
- func (_m *API) GetConfig() *model.Config
- func (_m *API) GetDiagnosticId() string
- func (_m *API) GetDirectChannel(userId1 string, userId2 string) (*model.Channel, *model.AppError)
- func (_m *API) GetEmoji(emojiId string) (*model.Emoji, *model.AppError)
- func (_m *API) GetEmojiByName(name string) (*model.Emoji, *model.AppError)
- func (_m *API) GetEmojiImage(emojiId string) ([]byte, string, *model.AppError)
- func (_m *API) GetEmojiList(sortBy string, page int, perPage int) ([]*model.Emoji, *model.AppError)
- func (_m *API) GetFile(fileId string) ([]byte, *model.AppError)
- func (_m *API) GetFileInfo(fileId string) (*model.FileInfo, *model.AppError)
- func (_m *API) GetFileInfos(page int, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError)
- func (_m *API) GetFileLink(fileId string) (string, *model.AppError)
- func (_m *API) GetGroup(groupId string) (*model.Group, *model.AppError)
- func (_m *API) GetGroupByName(name string) (*model.Group, *model.AppError)
- func (_m *API) GetGroupChannel(userIds []string) (*model.Channel, *model.AppError)
- func (_m *API) GetGroupMemberUsers(groupID string, page int, perPage int) ([]*model.User, *model.AppError)
- func (_m *API) GetGroupsBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError)
- func (_m *API) GetGroupsForUser(userID string) ([]*model.Group, *model.AppError)
- func (_m *API) GetLDAPUserAttributes(userID string, attributes []string) (map[string]string, *model.AppError)
- func (_m *API) GetLicense() *model.License
- func (_m *API) GetOAuthApp(appID string) (*model.OAuthApp, *model.AppError)
- func (_m *API) GetPluginConfig() map[string]interface{}
- func (_m *API) GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)
- func (_m *API) GetPlugins() ([]*model.Manifest, *model.AppError)
- func (_m *API) GetPost(postId string) (*model.Post, *model.AppError)
- func (_m *API) GetPostThread(postId string) (*model.PostList, *model.AppError)
- func (_m *API) GetPostsAfter(channelId string, postId string, page int, perPage int) (*model.PostList, *model.AppError)
- func (_m *API) GetPostsBefore(channelId string, postId string, page int, perPage int) (*model.PostList, *model.AppError)
- func (_m *API) GetPostsForChannel(channelId string, page int, perPage int) (*model.PostList, *model.AppError)
- func (_m *API) GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError)
- func (_m *API) GetPreferencesForUser(userID string) ([]model.Preference, *model.AppError)
- func (_m *API) GetProfileImage(userID string) ([]byte, *model.AppError)
- func (_m *API) GetPublicChannelsForTeam(teamID string, page int, perPage int) ([]*model.Channel, *model.AppError)
- func (_m *API) GetReactions(postId string) ([]*model.Reaction, *model.AppError)
- func (_m *API) GetServerVersion() string
- func (_m *API) GetSession(sessionID string) (*model.Session, *model.AppError)
- func (_m *API) GetSystemInstallDate() (int64, *model.AppError)
- func (_m *API) GetTeam(teamID string) (*model.Team, *model.AppError)
- func (_m *API) GetTeamByName(name string) (*model.Team, *model.AppError)
- func (_m *API) GetTeamIcon(teamID string) ([]byte, *model.AppError)
- func (_m *API) GetTeamMember(teamID string, userID string) (*model.TeamMember, *model.AppError)
- func (_m *API) GetTeamMembers(teamID string, page int, perPage int) ([]*model.TeamMember, *model.AppError)
- func (_m *API) GetTeamMembersForUser(userID string, page int, perPage int) ([]*model.TeamMember, *model.AppError)
- func (_m *API) GetTeamStats(teamID string) (*model.TeamStats, *model.AppError)
- func (_m *API) GetTeams() ([]*model.Team, *model.AppError)
- func (_m *API) GetTeamsForUser(userID string) ([]*model.Team, *model.AppError)
- func (_m *API) GetTeamsUnreadForUser(userID string) ([]*model.TeamUnread, *model.AppError)
- func (_m *API) GetTelemetryId() string
- func (_m *API) GetUnsanitizedConfig() *model.Config
- func (_m *API) GetUser(userID string) (*model.User, *model.AppError)
- func (_m *API) GetUserByEmail(email string) (*model.User, *model.AppError)
- func (_m *API) GetUserByUsername(name string) (*model.User, *model.AppError)
- func (_m *API) GetUserStatus(userID string) (*model.Status, *model.AppError)
- func (_m *API) GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.AppError)
- func (_m *API) GetUsers(options *model.UserGetOptions) ([]*model.User, *model.AppError)
- func (_m *API) GetUsersByUsernames(usernames []string) ([]*model.User, *model.AppError)
- func (_m *API) GetUsersInChannel(channelID string, sortBy string, page int, perPage int) ([]*model.User, *model.AppError)
- func (_m *API) GetUsersInTeam(teamID string, page int, perPage int) ([]*model.User, *model.AppError)
- func (_m *API) HasPermissionTo(userID string, permission *model.Permission) bool
- func (_m *API) HasPermissionToChannel(userID string, channelId string, permission *model.Permission) bool
- func (_m *API) HasPermissionToTeam(userID string, teamID string, permission *model.Permission) bool
- func (_m *API) InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *model.AppError)
- func (_m *API) IsEnterpriseReady() bool
- func (_m *API) KVCompareAndDelete(key string, oldValue []byte) (bool, *model.AppError)
- func (_m *API) KVCompareAndSet(key string, oldValue []byte, newValue []byte) (bool, *model.AppError)
- func (_m *API) KVDelete(key string) *model.AppError
- func (_m *API) KVDeleteAll() *model.AppError
- func (_m *API) KVGet(key string) ([]byte, *model.AppError)
- func (_m *API) KVList(page int, perPage int) ([]string, *model.AppError)
- func (_m *API) KVSet(key string, value []byte) *model.AppError
- func (_m *API) KVSetWithExpiry(key string, value []byte, expireInSeconds int64) *model.AppError
- func (_m *API) KVSetWithOptions(key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError)
- func (_m *API) ListBuiltInCommands() ([]*model.Command, error)
- func (_m *API) ListCommands(teamID string) ([]*model.Command, error)
- func (_m *API) ListCustomCommands(teamID string) ([]*model.Command, error)
- func (_m *API) ListPluginCommands(teamID string) ([]*model.Command, error)
- func (_m *API) LoadPluginConfiguration(dest interface{}) error
- func (_m *API) LogDebug(msg string, keyValuePairs ...interface{})
- func (_m *API) LogError(msg string, keyValuePairs ...interface{})
- func (_m *API) LogInfo(msg string, keyValuePairs ...interface{})
- func (_m *API) LogWarn(msg string, keyValuePairs ...interface{})
- func (_m *API) OpenInteractiveDialog(dialog model.OpenDialogRequest) *model.AppError
- func (_m *API) PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)
- func (_m *API) PermanentDeleteBot(botUserId string) *model.AppError
- func (_m *API) PluginHTTP(request *http.Request) *http.Response
- func (_m *API) PublishPluginClusterEvent(ev model.PluginClusterEvent, opts model.PluginClusterEventSendOptions) error
- func (_m *API) PublishUserTyping(userID string, channelId string, parentId string) *model.AppError
- func (_m *API) PublishWebSocketEvent(event string, payload map[string]interface{}, ...)
- func (_m *API) ReadFile(path string) ([]byte, *model.AppError)
- func (_m *API) RegisterCommand(command *model.Command) error
- func (_m *API) RemovePlugin(id string) *model.AppError
- func (_m *API) RemoveReaction(reaction *model.Reaction) *model.AppError
- func (_m *API) RemoveTeamIcon(teamID string) *model.AppError
- func (_m *API) RemoveUserCustomStatus(userID string) *model.AppError
- func (_m *API) RequestTrialLicense(requesterID string, users int, termsAccepted bool, receiveEmailsAccepted bool) *model.AppError
- func (_m *API) RevokeSession(sessionID string) *model.AppError
- func (_m *API) RevokeUserAccessToken(tokenID string) *model.AppError
- func (_m *API) RolesGrantPermission(roleNames []string, permissionId string) bool
- func (_m *API) SaveConfig(config *model.Config) *model.AppError
- func (_m *API) SavePluginConfig(config map[string]interface{}) *model.AppError
- func (_m *API) SearchChannels(teamID string, term string) ([]*model.Channel, *model.AppError)
- func (_m *API) SearchPostsInTeam(teamID string, paramsList []*model.SearchParams) ([]*model.Post, *model.AppError)
- func (_m *API) SearchPostsInTeamForUser(teamID string, userID string, searchParams model.SearchParameter) (*model.PostSearchResults, *model.AppError)
- func (_m *API) SearchTeams(term string) ([]*model.Team, *model.AppError)
- func (_m *API) SearchUsers(search *model.UserSearch) ([]*model.User, *model.AppError)
- func (_m *API) SendEphemeralPost(userID string, post *model.Post) *model.Post
- func (_m *API) SendMail(to string, subject string, htmlBody string) *model.AppError
- func (_m *API) SetProfileImage(userID string, data []byte) *model.AppError
- func (_m *API) SetTeamIcon(teamID string, data []byte) *model.AppError
- func (_m *API) SetUserStatusTimedDND(userId string, endtime int64) (*model.Status, *model.AppError)
- func (_m *API) UnregisterCommand(teamID string, trigger string) error
- func (_m *API) UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError)
- func (_m *API) UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)
- func (_m *API) UpdateChannelMemberNotifications(channelId string, userID string, notifications map[string]string) (*model.ChannelMember, *model.AppError)
- func (_m *API) UpdateChannelMemberRoles(channelId string, userID string, newRoles string) (*model.ChannelMember, *model.AppError)
- func (_m *API) UpdateChannelSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError)
- func (_m *API) UpdateCommand(commandID string, updatedCmd *model.Command) (*model.Command, error)
- func (_m *API) UpdateEphemeralPost(userID string, post *model.Post) *model.Post
- func (_m *API) UpdateOAuthApp(app *model.OAuthApp) (*model.OAuthApp, *model.AppError)
- func (_m *API) UpdatePost(post *model.Post) (*model.Post, *model.AppError)
- func (_m *API) UpdatePreferencesForUser(userID string, preferences []model.Preference) *model.AppError
- func (_m *API) UpdateTeam(team *model.Team) (*model.Team, *model.AppError)
- func (_m *API) UpdateTeamMemberRoles(teamID string, userID string, newRoles string) (*model.TeamMember, *model.AppError)
- func (_m *API) UpdateUser(user *model.User) (*model.User, *model.AppError)
- func (_m *API) UpdateUserActive(userID string, active bool) *model.AppError
- func (_m *API) UpdateUserCustomStatus(userID string, customStatus *model.CustomStatus) *model.AppError
- func (_m *API) UpdateUserStatus(userID string, status string) (*model.Status, *model.AppError)
- func (_m *API) UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)
- type Driver
- func (_m *Driver) Conn(isMaster bool) (string, error)
- func (_m *Driver) ConnClose(connID string) error
- func (_m *Driver) ConnExec(connID string, q string, args []driver.NamedValue) (plugin.ResultContainer, error)
- func (_m *Driver) ConnPing(connID string) error
- func (_m *Driver) ConnQuery(connID string, q string, args []driver.NamedValue) (string, error)
- func (_m *Driver) RowsClose(rowsID string) error
- func (_m *Driver) RowsColumnTypeDatabaseTypeName(rowsID string, index int) string
- func (_m *Driver) RowsColumnTypePrecisionScale(rowsID string, index int) (int64, int64, bool)
- func (_m *Driver) RowsColumns(rowsID string) []string
- func (_m *Driver) RowsHasNextResultSet(rowsID string) bool
- func (_m *Driver) RowsNext(rowsID string, dest []driver.Value) error
- func (_m *Driver) RowsNextResultSet(rowsID string) error
- func (_m *Driver) Stmt(connID string, q string) (string, error)
- func (_m *Driver) StmtClose(stID string) error
- func (_m *Driver) StmtExec(stID string, args []driver.NamedValue) (plugin.ResultContainer, error)
- func (_m *Driver) StmtNumInput(stID string) int
- func (_m *Driver) StmtQuery(stID string, args []driver.NamedValue) (string, error)
- func (_m *Driver) Tx(connID string, opts driver.TxOptions) (string, error)
- func (_m *Driver) TxCommit(txID string) error
- func (_m *Driver) TxRollback(txID string) error
- type Hooks
- func (_m *Hooks) ChannelHasBeenCreated(c *plugin.Context, channel *model.Channel)
- func (_m *Hooks) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
- func (_m *Hooks) FileWillBeUploaded(c *plugin.Context, info *model.FileInfo, file io.Reader, output io.Writer) (*model.FileInfo, string)
- func (_m *Hooks) Implemented() ([]string, error)
- func (_m *Hooks) MessageHasBeenPosted(c *plugin.Context, post *model.Post)
- func (_m *Hooks) MessageHasBeenUpdated(c *plugin.Context, newPost *model.Post, oldPost *model.Post)
- func (_m *Hooks) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string)
- func (_m *Hooks) MessageWillBeUpdated(c *plugin.Context, newPost *model.Post, oldPost *model.Post) (*model.Post, string)
- func (_m *Hooks) OnActivate() error
- func (_m *Hooks) OnConfigurationChange() error
- func (_m *Hooks) OnDeactivate() error
- func (_m *Hooks) OnInstall(c *plugin.Context, event model.OnInstallEvent) error
- func (_m *Hooks) OnPluginClusterEvent(c *plugin.Context, ev model.PluginClusterEvent)
- func (_m *Hooks) OnSendDailyTelemetry()
- func (_m *Hooks) OnWebSocketConnect(webConnID string, userID string)
- func (_m *Hooks) OnWebSocketDisconnect(webConnID string, userID string)
- func (_m *Hooks) ReactionHasBeenAdded(c *plugin.Context, reaction *model.Reaction)
- func (_m *Hooks) ReactionHasBeenRemoved(c *plugin.Context, reaction *model.Reaction)
- func (_m *Hooks) RunDataRetention(nowTime int64, batchSize int64) (int64, error)
- func (_m *Hooks) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request)
- func (_m *Hooks) UserHasBeenCreated(c *plugin.Context, user *model.User)
- func (_m *Hooks) UserHasJoinedChannel(c *plugin.Context, channelMember *model.ChannelMember, actor *model.User)
- func (_m *Hooks) UserHasJoinedTeam(c *plugin.Context, teamMember *model.TeamMember, actor *model.User)
- func (_m *Hooks) UserHasLeftChannel(c *plugin.Context, channelMember *model.ChannelMember, actor *model.User)
- func (_m *Hooks) UserHasLeftTeam(c *plugin.Context, teamMember *model.TeamMember, actor *model.User)
- func (_m *Hooks) UserHasLoggedIn(c *plugin.Context, user *model.User)
- func (_m *Hooks) UserWillLogIn(c *plugin.Context, user *model.User) string
- func (_m *Hooks) WebSocketMessageHasBeenPosted(webConnID string, userID string, req *model.WebSocketRequest)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
API is an autogenerated mock type for the API type
func (*API) AddChannelMember ¶
func (_m *API) AddChannelMember(channelId string, userID string) (*model.ChannelMember, *model.AppError)
AddChannelMember provides a mock function with given fields: channelId, userID
func (*API) AddReaction ¶
AddReaction provides a mock function with given fields: reaction
func (*API) AddUserToChannel ¶
func (_m *API) AddUserToChannel(channelId string, userID string, asUserId string) (*model.ChannelMember, *model.AppError)
AddUserToChannel provides a mock function with given fields: channelId, userID, asUserId
func (*API) CopyFileInfos ¶
CopyFileInfos provides a mock function with given fields: userID, fileIds
func (*API) CreateChannel ¶
CreateChannel provides a mock function with given fields: channel
func (*API) CreateChannelSidebarCategory ¶
func (_m *API) CreateChannelSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, *model.AppError)
CreateChannelSidebarCategory provides a mock function with given fields: userID, teamID, newCategory
func (*API) CreateCommand ¶
CreateCommand provides a mock function with given fields: cmd
func (*API) CreateOAuthApp ¶
CreateOAuthApp provides a mock function with given fields: app
func (*API) CreatePost ¶
CreatePost provides a mock function with given fields: post
func (*API) CreateSession ¶ added in v6.2.0
CreateSession provides a mock function with given fields: session
func (*API) CreateTeam ¶
CreateTeam provides a mock function with given fields: team
func (*API) CreateTeamMember ¶
CreateTeamMember provides a mock function with given fields: teamID, userID
func (*API) CreateTeamMembers ¶
func (_m *API) CreateTeamMembers(teamID string, userIds []string, requestorId string) ([]*model.TeamMember, *model.AppError)
CreateTeamMembers provides a mock function with given fields: teamID, userIds, requestorId
func (*API) CreateTeamMembersGracefully ¶
func (_m *API) CreateTeamMembersGracefully(teamID string, userIds []string, requestorId string) ([]*model.TeamMemberWithError, *model.AppError)
CreateTeamMembersGracefully provides a mock function with given fields: teamID, userIds, requestorId
func (*API) CreateUser ¶
CreateUser provides a mock function with given fields: user
func (*API) CreateUserAccessToken ¶
func (_m *API) CreateUserAccessToken(token *model.UserAccessToken) (*model.UserAccessToken, *model.AppError)
CreateUserAccessToken provides a mock function with given fields: token
func (*API) DeleteChannel ¶
DeleteChannel provides a mock function with given fields: channelId
func (*API) DeleteChannelMember ¶
DeleteChannelMember provides a mock function with given fields: channelId, userID
func (*API) DeleteCommand ¶
DeleteCommand provides a mock function with given fields: commandID
func (*API) DeleteEphemeralPost ¶
DeleteEphemeralPost provides a mock function with given fields: userID, postId
func (*API) DeleteOAuthApp ¶
DeleteOAuthApp provides a mock function with given fields: appID
func (*API) DeletePost ¶
DeletePost provides a mock function with given fields: postId
func (*API) DeletePreferencesForUser ¶
func (_m *API) DeletePreferencesForUser(userID string, preferences []model.Preference) *model.AppError
DeletePreferencesForUser provides a mock function with given fields: userID, preferences
func (*API) DeleteTeam ¶
DeleteTeam provides a mock function with given fields: teamID
func (*API) DeleteTeamMember ¶
DeleteTeamMember provides a mock function with given fields: teamID, userID, requestorId
func (*API) DeleteUser ¶
DeleteUser provides a mock function with given fields: userID
func (*API) DisablePlugin ¶
DisablePlugin provides a mock function with given fields: id
func (*API) EnablePlugin ¶
EnablePlugin provides a mock function with given fields: id
func (*API) ExecuteSlashCommand ¶
func (_m *API) ExecuteSlashCommand(commandArgs *model.CommandArgs) (*model.CommandResponse, error)
ExecuteSlashCommand provides a mock function with given fields: commandArgs
func (*API) ExtendSessionExpiry ¶ added in v6.2.0
ExtendSessionExpiry provides a mock function with given fields: sessionID, newExpiry
func (*API) GetBundlePath ¶
GetBundlePath provides a mock function with given fields:
func (*API) GetChannel ¶
GetChannel provides a mock function with given fields: channelId
func (*API) GetChannelByName ¶
func (_m *API) GetChannelByName(teamID string, name string, includeDeleted bool) (*model.Channel, *model.AppError)
GetChannelByName provides a mock function with given fields: teamID, name, includeDeleted
func (*API) GetChannelByNameForTeamName ¶
func (_m *API) GetChannelByNameForTeamName(teamName string, channelName string, includeDeleted bool) (*model.Channel, *model.AppError)
GetChannelByNameForTeamName provides a mock function with given fields: teamName, channelName, includeDeleted
func (*API) GetChannelMember ¶
func (_m *API) GetChannelMember(channelId string, userID string) (*model.ChannelMember, *model.AppError)
GetChannelMember provides a mock function with given fields: channelId, userID
func (*API) GetChannelMembers ¶
func (_m *API) GetChannelMembers(channelId string, page int, perPage int) (model.ChannelMembers, *model.AppError)
GetChannelMembers provides a mock function with given fields: channelId, page, perPage
func (*API) GetChannelMembersByIds ¶
func (_m *API) GetChannelMembersByIds(channelId string, userIds []string) (model.ChannelMembers, *model.AppError)
GetChannelMembersByIds provides a mock function with given fields: channelId, userIds
func (*API) GetChannelMembersForUser ¶
func (_m *API) GetChannelMembersForUser(teamID string, userID string, page int, perPage int) ([]*model.ChannelMember, *model.AppError)
GetChannelMembersForUser provides a mock function with given fields: teamID, userID, page, perPage
func (*API) GetChannelSidebarCategories ¶
func (_m *API) GetChannelSidebarCategories(userID string, teamID string) (*model.OrderedSidebarCategories, *model.AppError)
GetChannelSidebarCategories provides a mock function with given fields: userID, teamID
func (*API) GetChannelStats ¶
GetChannelStats provides a mock function with given fields: channelId
func (*API) GetChannelsForTeamForUser ¶
func (_m *API) GetChannelsForTeamForUser(teamID string, userID string, includeDeleted bool) ([]*model.Channel, *model.AppError)
GetChannelsForTeamForUser provides a mock function with given fields: teamID, userID, includeDeleted
func (*API) GetCommand ¶
GetCommand provides a mock function with given fields: commandID
func (*API) GetDiagnosticId ¶
GetDiagnosticId provides a mock function with given fields:
func (*API) GetDirectChannel ¶
GetDirectChannel provides a mock function with given fields: userId1, userId2
func (*API) GetEmojiByName ¶
GetEmojiByName provides a mock function with given fields: name
func (*API) GetEmojiImage ¶
GetEmojiImage provides a mock function with given fields: emojiId
func (*API) GetEmojiList ¶
GetEmojiList provides a mock function with given fields: sortBy, page, perPage
func (*API) GetFileInfo ¶
GetFileInfo provides a mock function with given fields: fileId
func (*API) GetFileInfos ¶
func (_m *API) GetFileInfos(page int, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, *model.AppError)
GetFileInfos provides a mock function with given fields: page, perPage, opt
func (*API) GetFileLink ¶
GetFileLink provides a mock function with given fields: fileId
func (*API) GetGroupByName ¶
GetGroupByName provides a mock function with given fields: name
func (*API) GetGroupChannel ¶
GetGroupChannel provides a mock function with given fields: userIds
func (*API) GetGroupMemberUsers ¶
func (_m *API) GetGroupMemberUsers(groupID string, page int, perPage int) ([]*model.User, *model.AppError)
GetGroupMemberUsers provides a mock function with given fields: groupID, page, perPage
func (*API) GetGroupsBySource ¶
GetGroupsBySource provides a mock function with given fields: groupSource
func (*API) GetGroupsForUser ¶
GetGroupsForUser provides a mock function with given fields: userID
func (*API) GetLDAPUserAttributes ¶
func (_m *API) GetLDAPUserAttributes(userID string, attributes []string) (map[string]string, *model.AppError)
GetLDAPUserAttributes provides a mock function with given fields: userID, attributes
func (*API) GetLicense ¶
GetLicense provides a mock function with given fields:
func (*API) GetOAuthApp ¶
GetOAuthApp provides a mock function with given fields: appID
func (*API) GetPluginConfig ¶
GetPluginConfig provides a mock function with given fields:
func (*API) GetPluginStatus ¶
GetPluginStatus provides a mock function with given fields: id
func (*API) GetPlugins ¶
GetPlugins provides a mock function with given fields:
func (*API) GetPostThread ¶
GetPostThread provides a mock function with given fields: postId
func (*API) GetPostsAfter ¶
func (_m *API) GetPostsAfter(channelId string, postId string, page int, perPage int) (*model.PostList, *model.AppError)
GetPostsAfter provides a mock function with given fields: channelId, postId, page, perPage
func (*API) GetPostsBefore ¶
func (_m *API) GetPostsBefore(channelId string, postId string, page int, perPage int) (*model.PostList, *model.AppError)
GetPostsBefore provides a mock function with given fields: channelId, postId, page, perPage
func (*API) GetPostsForChannel ¶
func (_m *API) GetPostsForChannel(channelId string, page int, perPage int) (*model.PostList, *model.AppError)
GetPostsForChannel provides a mock function with given fields: channelId, page, perPage
func (*API) GetPostsSince ¶
GetPostsSince provides a mock function with given fields: channelId, time
func (*API) GetPreferencesForUser ¶
GetPreferencesForUser provides a mock function with given fields: userID
func (*API) GetProfileImage ¶
GetProfileImage provides a mock function with given fields: userID
func (*API) GetPublicChannelsForTeam ¶
func (_m *API) GetPublicChannelsForTeam(teamID string, page int, perPage int) ([]*model.Channel, *model.AppError)
GetPublicChannelsForTeam provides a mock function with given fields: teamID, page, perPage
func (*API) GetReactions ¶
GetReactions provides a mock function with given fields: postId
func (*API) GetServerVersion ¶
GetServerVersion provides a mock function with given fields:
func (*API) GetSession ¶
GetSession provides a mock function with given fields: sessionID
func (*API) GetSystemInstallDate ¶
GetSystemInstallDate provides a mock function with given fields:
func (*API) GetTeamByName ¶
GetTeamByName provides a mock function with given fields: name
func (*API) GetTeamIcon ¶
GetTeamIcon provides a mock function with given fields: teamID
func (*API) GetTeamMember ¶
GetTeamMember provides a mock function with given fields: teamID, userID
func (*API) GetTeamMembers ¶
func (_m *API) GetTeamMembers(teamID string, page int, perPage int) ([]*model.TeamMember, *model.AppError)
GetTeamMembers provides a mock function with given fields: teamID, page, perPage
func (*API) GetTeamMembersForUser ¶
func (_m *API) GetTeamMembersForUser(userID string, page int, perPage int) ([]*model.TeamMember, *model.AppError)
GetTeamMembersForUser provides a mock function with given fields: userID, page, perPage
func (*API) GetTeamStats ¶
GetTeamStats provides a mock function with given fields: teamID
func (*API) GetTeamsForUser ¶
GetTeamsForUser provides a mock function with given fields: userID
func (*API) GetTeamsUnreadForUser ¶
GetTeamsUnreadForUser provides a mock function with given fields: userID
func (*API) GetTelemetryId ¶
GetTelemetryId provides a mock function with given fields:
func (*API) GetUnsanitizedConfig ¶
GetUnsanitizedConfig provides a mock function with given fields:
func (*API) GetUserByEmail ¶
GetUserByEmail provides a mock function with given fields: email
func (*API) GetUserByUsername ¶
GetUserByUsername provides a mock function with given fields: name
func (*API) GetUserStatus ¶
GetUserStatus provides a mock function with given fields: userID
func (*API) GetUserStatusesByIds ¶
GetUserStatusesByIds provides a mock function with given fields: userIds
func (*API) GetUsersByUsernames ¶
GetUsersByUsernames provides a mock function with given fields: usernames
func (*API) GetUsersInChannel ¶
func (_m *API) GetUsersInChannel(channelID string, sortBy string, page int, perPage int) ([]*model.User, *model.AppError)
GetUsersInChannel provides a mock function with given fields: channelID, sortBy, page, perPage
func (*API) GetUsersInTeam ¶
func (_m *API) GetUsersInTeam(teamID string, page int, perPage int) ([]*model.User, *model.AppError)
GetUsersInTeam provides a mock function with given fields: teamID, page, perPage
func (*API) HasPermissionTo ¶
func (_m *API) HasPermissionTo(userID string, permission *model.Permission) bool
HasPermissionTo provides a mock function with given fields: userID, permission
func (*API) HasPermissionToChannel ¶
func (_m *API) HasPermissionToChannel(userID string, channelId string, permission *model.Permission) bool
HasPermissionToChannel provides a mock function with given fields: userID, channelId, permission
func (*API) HasPermissionToTeam ¶
HasPermissionToTeam provides a mock function with given fields: userID, teamID, permission
func (*API) InstallPlugin ¶
InstallPlugin provides a mock function with given fields: file, replace
func (*API) IsEnterpriseReady ¶ added in v6.2.0
IsEnterpriseReady provides a mock function with given fields:
func (*API) KVCompareAndDelete ¶
KVCompareAndDelete provides a mock function with given fields: key, oldValue
func (*API) KVCompareAndSet ¶
func (_m *API) KVCompareAndSet(key string, oldValue []byte, newValue []byte) (bool, *model.AppError)
KVCompareAndSet provides a mock function with given fields: key, oldValue, newValue
func (*API) KVDeleteAll ¶
KVDeleteAll provides a mock function with given fields:
func (*API) KVSetWithExpiry ¶
KVSetWithExpiry provides a mock function with given fields: key, value, expireInSeconds
func (*API) KVSetWithOptions ¶
func (_m *API) KVSetWithOptions(key string, value []byte, options model.PluginKVSetOptions) (bool, *model.AppError)
KVSetWithOptions provides a mock function with given fields: key, value, options
func (*API) ListBuiltInCommands ¶
ListBuiltInCommands provides a mock function with given fields:
func (*API) ListCommands ¶
ListCommands provides a mock function with given fields: teamID
func (*API) ListCustomCommands ¶
ListCustomCommands provides a mock function with given fields: teamID
func (*API) ListPluginCommands ¶
ListPluginCommands provides a mock function with given fields: teamID
func (*API) LoadPluginConfiguration ¶
LoadPluginConfiguration provides a mock function with given fields: dest
func (*API) OpenInteractiveDialog ¶
func (_m *API) OpenInteractiveDialog(dialog model.OpenDialogRequest) *model.AppError
OpenInteractiveDialog provides a mock function with given fields: dialog
func (*API) PermanentDeleteBot ¶
PermanentDeleteBot provides a mock function with given fields: botUserId
func (*API) PluginHTTP ¶
PluginHTTP provides a mock function with given fields: request
func (*API) PublishPluginClusterEvent ¶
func (_m *API) PublishPluginClusterEvent(ev model.PluginClusterEvent, opts model.PluginClusterEventSendOptions) error
PublishPluginClusterEvent provides a mock function with given fields: ev, opts
func (*API) PublishUserTyping ¶
PublishUserTyping provides a mock function with given fields: userID, channelId, parentId
func (*API) PublishWebSocketEvent ¶
func (_m *API) PublishWebSocketEvent(event string, payload map[string]interface{}, broadcast *model.WebsocketBroadcast)
PublishWebSocketEvent provides a mock function with given fields: event, payload, broadcast
func (*API) RegisterCommand ¶
RegisterCommand provides a mock function with given fields: command
func (*API) RemovePlugin ¶
RemovePlugin provides a mock function with given fields: id
func (*API) RemoveReaction ¶
RemoveReaction provides a mock function with given fields: reaction
func (*API) RemoveTeamIcon ¶
RemoveTeamIcon provides a mock function with given fields: teamID
func (*API) RemoveUserCustomStatus ¶ added in v6.2.0
RemoveUserCustomStatus provides a mock function with given fields: userID
func (*API) RequestTrialLicense ¶
func (_m *API) RequestTrialLicense(requesterID string, users int, termsAccepted bool, receiveEmailsAccepted bool) *model.AppError
RequestTrialLicense provides a mock function with given fields: requesterID, users, termsAccepted, receiveEmailsAccepted
func (*API) RevokeSession ¶ added in v6.2.0
RevokeSession provides a mock function with given fields: sessionID
func (*API) RevokeUserAccessToken ¶
RevokeUserAccessToken provides a mock function with given fields: tokenID
func (*API) RolesGrantPermission ¶ added in v6.3.0
RolesGrantPermission provides a mock function with given fields: roleNames, permissionId
func (*API) SaveConfig ¶
SaveConfig provides a mock function with given fields: config
func (*API) SavePluginConfig ¶
SavePluginConfig provides a mock function with given fields: config
func (*API) SearchChannels ¶
SearchChannels provides a mock function with given fields: teamID, term
func (*API) SearchPostsInTeam ¶
func (_m *API) SearchPostsInTeam(teamID string, paramsList []*model.SearchParams) ([]*model.Post, *model.AppError)
SearchPostsInTeam provides a mock function with given fields: teamID, paramsList
func (*API) SearchPostsInTeamForUser ¶
func (_m *API) SearchPostsInTeamForUser(teamID string, userID string, searchParams model.SearchParameter) (*model.PostSearchResults, *model.AppError)
SearchPostsInTeamForUser provides a mock function with given fields: teamID, userID, searchParams
func (*API) SearchTeams ¶
SearchTeams provides a mock function with given fields: term
func (*API) SearchUsers ¶
SearchUsers provides a mock function with given fields: search
func (*API) SendEphemeralPost ¶
SendEphemeralPost provides a mock function with given fields: userID, post
func (*API) SetProfileImage ¶
SetProfileImage provides a mock function with given fields: userID, data
func (*API) SetTeamIcon ¶
SetTeamIcon provides a mock function with given fields: teamID, data
func (*API) SetUserStatusTimedDND ¶
SetUserStatusTimedDND provides a mock function with given fields: userId, endtime
func (*API) UnregisterCommand ¶
UnregisterCommand provides a mock function with given fields: teamID, trigger
func (*API) UpdateBotActive ¶
UpdateBotActive provides a mock function with given fields: botUserId, active
func (*API) UpdateChannel ¶
UpdateChannel provides a mock function with given fields: channel
func (*API) UpdateChannelMemberNotifications ¶
func (_m *API) UpdateChannelMemberNotifications(channelId string, userID string, notifications map[string]string) (*model.ChannelMember, *model.AppError)
UpdateChannelMemberNotifications provides a mock function with given fields: channelId, userID, notifications
func (*API) UpdateChannelMemberRoles ¶
func (_m *API) UpdateChannelMemberRoles(channelId string, userID string, newRoles string) (*model.ChannelMember, *model.AppError)
UpdateChannelMemberRoles provides a mock function with given fields: channelId, userID, newRoles
func (*API) UpdateChannelSidebarCategories ¶
func (_m *API) UpdateChannelSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, *model.AppError)
UpdateChannelSidebarCategories provides a mock function with given fields: userID, teamID, categories
func (*API) UpdateCommand ¶
UpdateCommand provides a mock function with given fields: commandID, updatedCmd
func (*API) UpdateEphemeralPost ¶
UpdateEphemeralPost provides a mock function with given fields: userID, post
func (*API) UpdateOAuthApp ¶
UpdateOAuthApp provides a mock function with given fields: app
func (*API) UpdatePost ¶
UpdatePost provides a mock function with given fields: post
func (*API) UpdatePreferencesForUser ¶
func (_m *API) UpdatePreferencesForUser(userID string, preferences []model.Preference) *model.AppError
UpdatePreferencesForUser provides a mock function with given fields: userID, preferences
func (*API) UpdateTeam ¶
UpdateTeam provides a mock function with given fields: team
func (*API) UpdateTeamMemberRoles ¶
func (_m *API) UpdateTeamMemberRoles(teamID string, userID string, newRoles string) (*model.TeamMember, *model.AppError)
UpdateTeamMemberRoles provides a mock function with given fields: teamID, userID, newRoles
func (*API) UpdateUser ¶
UpdateUser provides a mock function with given fields: user
func (*API) UpdateUserActive ¶
UpdateUserActive provides a mock function with given fields: userID, active
func (*API) UpdateUserCustomStatus ¶ added in v6.2.0
func (_m *API) UpdateUserCustomStatus(userID string, customStatus *model.CustomStatus) *model.AppError
UpdateUserCustomStatus provides a mock function with given fields: userID, customStatus
func (*API) UpdateUserStatus ¶
UpdateUserStatus provides a mock function with given fields: userID, status
type Driver ¶
Driver is an autogenerated mock type for the Driver type
func (*Driver) ConnExec ¶
func (_m *Driver) ConnExec(connID string, q string, args []driver.NamedValue) (plugin.ResultContainer, error)
ConnExec provides a mock function with given fields: connID, q, args
func (*Driver) RowsColumnTypeDatabaseTypeName ¶
RowsColumnTypeDatabaseTypeName provides a mock function with given fields: rowsID, index
func (*Driver) RowsColumnTypePrecisionScale ¶
RowsColumnTypePrecisionScale provides a mock function with given fields: rowsID, index
func (*Driver) RowsColumns ¶
RowsColumns provides a mock function with given fields: rowsID
func (*Driver) RowsHasNextResultSet ¶
RowsHasNextResultSet provides a mock function with given fields: rowsID
func (*Driver) RowsNextResultSet ¶
RowsNextResultSet provides a mock function with given fields: rowsID
func (*Driver) StmtExec ¶
func (_m *Driver) StmtExec(stID string, args []driver.NamedValue) (plugin.ResultContainer, error)
StmtExec provides a mock function with given fields: stID, args
func (*Driver) StmtNumInput ¶
StmtNumInput provides a mock function with given fields: stID
func (*Driver) TxRollback ¶
TxRollback provides a mock function with given fields: txID
type Hooks ¶
Hooks is an autogenerated mock type for the Hooks type
func (*Hooks) ChannelHasBeenCreated ¶
ChannelHasBeenCreated provides a mock function with given fields: c, channel
func (*Hooks) ExecuteCommand ¶
func (_m *Hooks) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
ExecuteCommand provides a mock function with given fields: c, args
func (*Hooks) FileWillBeUploaded ¶
func (_m *Hooks) FileWillBeUploaded(c *plugin.Context, info *model.FileInfo, file io.Reader, output io.Writer) (*model.FileInfo, string)
FileWillBeUploaded provides a mock function with given fields: c, info, file, output
func (*Hooks) Implemented ¶
Implemented provides a mock function with given fields:
func (*Hooks) MessageHasBeenPosted ¶
MessageHasBeenPosted provides a mock function with given fields: c, post
func (*Hooks) MessageHasBeenUpdated ¶
MessageHasBeenUpdated provides a mock function with given fields: c, newPost, oldPost
func (*Hooks) MessageWillBePosted ¶
MessageWillBePosted provides a mock function with given fields: c, post
func (*Hooks) MessageWillBeUpdated ¶
func (_m *Hooks) MessageWillBeUpdated(c *plugin.Context, newPost *model.Post, oldPost *model.Post) (*model.Post, string)
MessageWillBeUpdated provides a mock function with given fields: c, newPost, oldPost
func (*Hooks) OnActivate ¶
OnActivate provides a mock function with given fields:
func (*Hooks) OnConfigurationChange ¶
OnConfigurationChange provides a mock function with given fields:
func (*Hooks) OnDeactivate ¶
OnDeactivate provides a mock function with given fields:
func (*Hooks) OnInstall ¶ added in v6.5.0
OnInstall provides a mock function with given fields: c, event
func (*Hooks) OnPluginClusterEvent ¶
func (_m *Hooks) OnPluginClusterEvent(c *plugin.Context, ev model.PluginClusterEvent)
OnPluginClusterEvent provides a mock function with given fields: c, ev
func (*Hooks) OnSendDailyTelemetry ¶ added in v6.5.0
func (_m *Hooks) OnSendDailyTelemetry()
OnSendDailyTelemetry provides a mock function with given fields:
func (*Hooks) OnWebSocketConnect ¶ added in v6.1.0
OnWebSocketConnect provides a mock function with given fields: webConnID, userID
func (*Hooks) OnWebSocketDisconnect ¶ added in v6.1.0
OnWebSocketDisconnect provides a mock function with given fields: webConnID, userID
func (*Hooks) ReactionHasBeenAdded ¶
ReactionHasBeenAdded provides a mock function with given fields: c, reaction
func (*Hooks) ReactionHasBeenRemoved ¶
ReactionHasBeenRemoved provides a mock function with given fields: c, reaction
func (*Hooks) RunDataRetention ¶ added in v6.4.0
RunDataRetention provides a mock function with given fields: nowTime, batchSize
func (*Hooks) UserHasBeenCreated ¶
UserHasBeenCreated provides a mock function with given fields: c, user
func (*Hooks) UserHasJoinedChannel ¶
func (_m *Hooks) UserHasJoinedChannel(c *plugin.Context, channelMember *model.ChannelMember, actor *model.User)
UserHasJoinedChannel provides a mock function with given fields: c, channelMember, actor
func (*Hooks) UserHasJoinedTeam ¶
func (_m *Hooks) UserHasJoinedTeam(c *plugin.Context, teamMember *model.TeamMember, actor *model.User)
UserHasJoinedTeam provides a mock function with given fields: c, teamMember, actor
func (*Hooks) UserHasLeftChannel ¶
func (_m *Hooks) UserHasLeftChannel(c *plugin.Context, channelMember *model.ChannelMember, actor *model.User)
UserHasLeftChannel provides a mock function with given fields: c, channelMember, actor
func (*Hooks) UserHasLeftTeam ¶
func (_m *Hooks) UserHasLeftTeam(c *plugin.Context, teamMember *model.TeamMember, actor *model.User)
UserHasLeftTeam provides a mock function with given fields: c, teamMember, actor
func (*Hooks) UserHasLoggedIn ¶
UserHasLoggedIn provides a mock function with given fields: c, user
func (*Hooks) UserWillLogIn ¶
UserWillLogIn provides a mock function with given fields: c, user
func (*Hooks) WebSocketMessageHasBeenPosted ¶ added in v6.1.0
func (_m *Hooks) WebSocketMessageHasBeenPosted(webConnID string, userID string, req *model.WebSocketRequest)
WebSocketMessageHasBeenPosted provides a mock function with given fields: webConnID, userID, req