plugintest

package
v0.0.0-...-16753fb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2021 License: AGPL-3.0, Apache-2.0 Imports: 5 Imported by: 0

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/v5/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/v5/model"
	"github.com/mattermost/mattermost-server/v5/plugin"
	"github.com/mattermost/mattermost-server/v5/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)

	helpers := &plugintest.Helpers{}
	defer helpers.AssertExpectations(t)

	p := &HelloUserPlugin{}
	p.SetAPI(api)
	p.SetHelpers(helpers)

	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

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	mock.Mock
}

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

func (_m *API) AddReaction(reaction *model.Reaction) (*model.Reaction, *model.AppError)

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

func (_m *API) CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError)

CopyFileInfos provides a mock function with given fields: userId, fileIds

func (*API) CreateBot

func (_m *API) CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)

CreateBot provides a mock function with given fields: bot

func (*API) CreateChannel

func (_m *API) CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError)

CreateChannel provides a mock function with given fields: channel

func (*API) CreateCommand

func (_m *API) CreateCommand(cmd *model.Command) (*model.Command, error)

CreateCommand provides a mock function with given fields: cmd

func (*API) CreatePost

func (_m *API) CreatePost(post *model.Post) (*model.Post, *model.AppError)

CreatePost provides a mock function with given fields: post

func (*API) CreateTeam

func (_m *API) CreateTeam(team *model.Team) (*model.Team, *model.AppError)

CreateTeam provides a mock function with given fields: team

func (*API) CreateTeamMember

func (_m *API) CreateTeamMember(teamId string, userId string) (*model.TeamMember, *model.AppError)

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

func (_m *API) CreateUser(user *model.User) (*model.User, *model.AppError)

CreateUser provides a mock function with given fields: user

func (*API) DeleteBotIconImage

func (_m *API) DeleteBotIconImage(botUserId string) *model.AppError

DeleteBotIconImage provides a mock function with given fields: botUserId

func (*API) DeleteChannel

func (_m *API) DeleteChannel(channelId string) *model.AppError

DeleteChannel provides a mock function with given fields: channelId

func (*API) DeleteChannelMember

func (_m *API) DeleteChannelMember(channelId string, userId string) *model.AppError

DeleteChannelMember provides a mock function with given fields: channelId, userId

func (*API) DeleteCommand

func (_m *API) DeleteCommand(commandID string) error

DeleteCommand provides a mock function with given fields: commandID

func (*API) DeleteEphemeralPost

func (_m *API) DeleteEphemeralPost(userId string, postId string)

DeleteEphemeralPost provides a mock function with given fields: userId, postId

func (*API) DeletePost

func (_m *API) DeletePost(postId string) *model.AppError

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

func (_m *API) DeleteTeam(teamId string) *model.AppError

DeleteTeam provides a mock function with given fields: teamId

func (*API) DeleteTeamMember

func (_m *API) DeleteTeamMember(teamId string, userId string, requestorId string) *model.AppError

DeleteTeamMember provides a mock function with given fields: teamId, userId, requestorId

func (*API) DeleteUser

func (_m *API) DeleteUser(userId string) *model.AppError

DeleteUser provides a mock function with given fields: userId

func (*API) DisablePlugin

func (_m *API) DisablePlugin(id string) *model.AppError

DisablePlugin provides a mock function with given fields: id

func (*API) EnablePlugin

func (_m *API) EnablePlugin(id string) *model.AppError

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) GetBot

func (_m *API) GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError)

GetBot provides a mock function with given fields: botUserId, includeDeleted

func (*API) GetBotIconImage

func (_m *API) GetBotIconImage(botUserId string) ([]byte, *model.AppError)

GetBotIconImage provides a mock function with given fields: botUserId

func (*API) GetBots

func (_m *API) GetBots(options *model.BotGetOptions) ([]*model.Bot, *model.AppError)

GetBots provides a mock function with given fields: options

func (*API) GetBundlePath

func (_m *API) GetBundlePath() (string, error)

GetBundlePath provides a mock function with given fields:

func (*API) GetChannel

func (_m *API) GetChannel(channelId string) (*model.Channel, *model.AppError)

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) GetChannelStats

func (_m *API) GetChannelStats(channelId string) (*model.ChannelStats, *model.AppError)

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

func (_m *API) GetCommand(commandID string) (*model.Command, error)

GetCommand provides a mock function with given fields: commandID

func (*API) GetConfig

func (_m *API) GetConfig() *model.Config

GetConfig provides a mock function with given fields:

func (*API) GetDiagnosticId

func (_m *API) GetDiagnosticId() string

GetDiagnosticId provides a mock function with given fields:

func (*API) GetDirectChannel

func (_m *API) GetDirectChannel(userId1 string, userId2 string) (*model.Channel, *model.AppError)

GetDirectChannel provides a mock function with given fields: userId1, userId2

func (*API) GetEmoji

func (_m *API) GetEmoji(emojiId string) (*model.Emoji, *model.AppError)

GetEmoji provides a mock function with given fields: emojiId

func (*API) GetEmojiByName

func (_m *API) GetEmojiByName(name string) (*model.Emoji, *model.AppError)

GetEmojiByName provides a mock function with given fields: name

func (*API) GetEmojiImage

func (_m *API) GetEmojiImage(emojiId string) ([]byte, string, *model.AppError)

GetEmojiImage provides a mock function with given fields: emojiId

func (*API) GetEmojiList

func (_m *API) GetEmojiList(sortBy string, page int, perPage int) ([]*model.Emoji, *model.AppError)

GetEmojiList provides a mock function with given fields: sortBy, page, perPage

func (*API) GetFile

func (_m *API) GetFile(fileId string) ([]byte, *model.AppError)

GetFile provides a mock function with given fields: fileId

func (*API) GetFileInfo

func (_m *API) GetFileInfo(fileId string) (*model.FileInfo, *model.AppError)

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 (_m *API) GetFileLink(fileId string) (string, *model.AppError)

GetFileLink provides a mock function with given fields: fileId

func (*API) GetGroup

func (_m *API) GetGroup(groupId string) (*model.Group, *model.AppError)

GetGroup provides a mock function with given fields: groupId

func (*API) GetGroupByName

func (_m *API) GetGroupByName(name string) (*model.Group, *model.AppError)

GetGroupByName provides a mock function with given fields: name

func (*API) GetGroupChannel

func (_m *API) GetGroupChannel(userIds []string) (*model.Channel, *model.AppError)

GetGroupChannel provides a mock function with given fields: userIds

func (*API) GetGroupsForUser

func (_m *API) GetGroupsForUser(userId string) ([]*model.Group, *model.AppError)

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

func (_m *API) GetLicense() *model.License

GetLicense provides a mock function with given fields:

func (*API) GetPluginConfig

func (_m *API) GetPluginConfig() map[string]interface{}

GetPluginConfig provides a mock function with given fields:

func (*API) GetPluginStatus

func (_m *API) GetPluginStatus(id string) (*model.PluginStatus, *model.AppError)

GetPluginStatus provides a mock function with given fields: id

func (*API) GetPlugins

func (_m *API) GetPlugins() ([]*model.Manifest, *model.AppError)

GetPlugins provides a mock function with given fields:

func (*API) GetPost

func (_m *API) GetPost(postId string) (*model.Post, *model.AppError)

GetPost provides a mock function with given fields: postId

func (*API) GetPostThread

func (_m *API) GetPostThread(postId string) (*model.PostList, *model.AppError)

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

func (_m *API) GetPostsSince(channelId string, time int64) (*model.PostList, *model.AppError)

GetPostsSince provides a mock function with given fields: channelId, time

func (*API) GetPreferencesForUser

func (_m *API) GetPreferencesForUser(userId string) ([]model.Preference, *model.AppError)

GetPreferencesForUser provides a mock function with given fields: userId

func (*API) GetProfileImage

func (_m *API) GetProfileImage(userId string) ([]byte, *model.AppError)

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

func (_m *API) GetReactions(postId string) ([]*model.Reaction, *model.AppError)

GetReactions provides a mock function with given fields: postId

func (*API) GetServerVersion

func (_m *API) GetServerVersion() string

GetServerVersion provides a mock function with given fields:

func (*API) GetSession

func (_m *API) GetSession(sessionId string) (*model.Session, *model.AppError)

GetSession provides a mock function with given fields: sessionId

func (*API) GetSystemInstallDate

func (_m *API) GetSystemInstallDate() (int64, *model.AppError)

GetSystemInstallDate provides a mock function with given fields:

func (*API) GetTeam

func (_m *API) GetTeam(teamId string) (*model.Team, *model.AppError)

GetTeam provides a mock function with given fields: teamId

func (*API) GetTeamByName

func (_m *API) GetTeamByName(name string) (*model.Team, *model.AppError)

GetTeamByName provides a mock function with given fields: name

func (*API) GetTeamIcon

func (_m *API) GetTeamIcon(teamId string) ([]byte, *model.AppError)

GetTeamIcon provides a mock function with given fields: teamId

func (*API) GetTeamMember

func (_m *API) GetTeamMember(teamId string, userId string) (*model.TeamMember, *model.AppError)

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

func (_m *API) GetTeamStats(teamId string) (*model.TeamStats, *model.AppError)

GetTeamStats provides a mock function with given fields: teamId

func (*API) GetTeams

func (_m *API) GetTeams() ([]*model.Team, *model.AppError)

GetTeams provides a mock function with given fields:

func (*API) GetTeamsForUser

func (_m *API) GetTeamsForUser(userId string) ([]*model.Team, *model.AppError)

GetTeamsForUser provides a mock function with given fields: userId

func (*API) GetTeamsUnreadForUser

func (_m *API) GetTeamsUnreadForUser(userId string) ([]*model.TeamUnread, *model.AppError)

GetTeamsUnreadForUser provides a mock function with given fields: userId

func (*API) GetTelemetryId

func (_m *API) GetTelemetryId() string

GetTelemetryId provides a mock function with given fields:

func (*API) GetUnsanitizedConfig

func (_m *API) GetUnsanitizedConfig() *model.Config

GetUnsanitizedConfig provides a mock function with given fields:

func (*API) GetUser

func (_m *API) GetUser(userId string) (*model.User, *model.AppError)

GetUser provides a mock function with given fields: userId

func (*API) GetUserByEmail

func (_m *API) GetUserByEmail(email string) (*model.User, *model.AppError)

GetUserByEmail provides a mock function with given fields: email

func (*API) GetUserByUsername

func (_m *API) GetUserByUsername(name string) (*model.User, *model.AppError)

GetUserByUsername provides a mock function with given fields: name

func (*API) GetUserStatus

func (_m *API) GetUserStatus(userId string) (*model.Status, *model.AppError)

GetUserStatus provides a mock function with given fields: userId

func (*API) GetUserStatusesByIds

func (_m *API) GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.AppError)

GetUserStatusesByIds provides a mock function with given fields: userIds

func (*API) GetUsers

func (_m *API) GetUsers(options *model.UserGetOptions) ([]*model.User, *model.AppError)

GetUsers provides a mock function with given fields: options

func (*API) GetUsersByUsernames

func (_m *API) GetUsersByUsernames(usernames []string) ([]*model.User, *model.AppError)

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

func (_m *API) HasPermissionToTeam(userId string, teamId string, permission *model.Permission) bool

HasPermissionToTeam provides a mock function with given fields: userId, teamId, permission

func (*API) InstallPlugin

func (_m *API) InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *model.AppError)

InstallPlugin provides a mock function with given fields: file, replace

func (*API) KVCompareAndDelete

func (_m *API) KVCompareAndDelete(key string, oldValue []byte) (bool, *model.AppError)

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) KVDelete

func (_m *API) KVDelete(key string) *model.AppError

KVDelete provides a mock function with given fields: key

func (*API) KVDeleteAll

func (_m *API) KVDeleteAll() *model.AppError

KVDeleteAll provides a mock function with given fields:

func (*API) KVGet

func (_m *API) KVGet(key string) ([]byte, *model.AppError)

KVGet provides a mock function with given fields: key

func (*API) KVList

func (_m *API) KVList(page int, perPage int) ([]string, *model.AppError)

KVList provides a mock function with given fields: page, perPage

func (*API) KVSet

func (_m *API) KVSet(key string, value []byte) *model.AppError

KVSet provides a mock function with given fields: key, value

func (*API) KVSetWithExpiry

func (_m *API) KVSetWithExpiry(key string, value []byte, expireInSeconds int64) *model.AppError

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

func (_m *API) ListBuiltInCommands() ([]*model.Command, error)

ListBuiltInCommands provides a mock function with given fields:

func (*API) ListCommands

func (_m *API) ListCommands(teamID string) ([]*model.Command, error)

ListCommands provides a mock function with given fields: teamID

func (*API) ListCustomCommands

func (_m *API) ListCustomCommands(teamID string) ([]*model.Command, error)

ListCustomCommands provides a mock function with given fields: teamID

func (*API) ListPluginCommands

func (_m *API) ListPluginCommands(teamID string) ([]*model.Command, error)

ListPluginCommands provides a mock function with given fields: teamID

func (*API) LoadPluginConfiguration

func (_m *API) LoadPluginConfiguration(dest interface{}) error

LoadPluginConfiguration provides a mock function with given fields: dest

func (*API) LogDebug

func (_m *API) LogDebug(msg string, keyValuePairs ...interface{})

LogDebug provides a mock function with given fields: msg, keyValuePairs

func (*API) LogError

func (_m *API) LogError(msg string, keyValuePairs ...interface{})

LogError provides a mock function with given fields: msg, keyValuePairs

func (*API) LogInfo

func (_m *API) LogInfo(msg string, keyValuePairs ...interface{})

LogInfo provides a mock function with given fields: msg, keyValuePairs

func (*API) LogWarn

func (_m *API) LogWarn(msg string, keyValuePairs ...interface{})

LogWarn provides a mock function with given fields: msg, keyValuePairs

func (*API) OpenInteractiveDialog

func (_m *API) OpenInteractiveDialog(dialog model.OpenDialogRequest) *model.AppError

OpenInteractiveDialog provides a mock function with given fields: dialog

func (*API) PatchBot

func (_m *API) PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)

PatchBot provides a mock function with given fields: botUserId, botPatch

func (*API) PermanentDeleteBot

func (_m *API) PermanentDeleteBot(botUserId string) *model.AppError

PermanentDeleteBot provides a mock function with given fields: botUserId

func (*API) PluginHTTP

func (_m *API) PluginHTTP(request *http.Request) *http.Response

PluginHTTP provides a mock function with given fields: request

func (*API) PublishUserTyping

func (_m *API) PublishUserTyping(userId string, channelId string, parentId string) *model.AppError

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) ReadFile

func (_m *API) ReadFile(path string) ([]byte, *model.AppError)

ReadFile provides a mock function with given fields: path

func (*API) RegisterCommand

func (_m *API) RegisterCommand(command *model.Command) error

RegisterCommand provides a mock function with given fields: command

func (*API) RemovePlugin

func (_m *API) RemovePlugin(id string) *model.AppError

RemovePlugin provides a mock function with given fields: id

func (*API) RemoveReaction

func (_m *API) RemoveReaction(reaction *model.Reaction) *model.AppError

RemoveReaction provides a mock function with given fields: reaction

func (*API) RemoveTeamIcon

func (_m *API) RemoveTeamIcon(teamId string) *model.AppError

RemoveTeamIcon provides a mock function with given fields: teamId

func (*API) SaveConfig

func (_m *API) SaveConfig(config *model.Config) *model.AppError

SaveConfig provides a mock function with given fields: config

func (*API) SavePluginConfig

func (_m *API) SavePluginConfig(config map[string]interface{}) *model.AppError

SavePluginConfig provides a mock function with given fields: config

func (*API) SearchChannels

func (_m *API) SearchChannels(teamId string, term string) ([]*model.Channel, *model.AppError)

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

func (_m *API) SearchTeams(term string) ([]*model.Team, *model.AppError)

SearchTeams provides a mock function with given fields: term

func (*API) SearchUsers

func (_m *API) SearchUsers(search *model.UserSearch) ([]*model.User, *model.AppError)

SearchUsers provides a mock function with given fields: search

func (*API) SendEphemeralPost

func (_m *API) SendEphemeralPost(userId string, post *model.Post) *model.Post

SendEphemeralPost provides a mock function with given fields: userId, post

func (*API) SendMail

func (_m *API) SendMail(to string, subject string, htmlBody string) *model.AppError

SendMail provides a mock function with given fields: to, subject, htmlBody

func (*API) SetBotIconImage

func (_m *API) SetBotIconImage(botUserId string, data []byte) *model.AppError

SetBotIconImage provides a mock function with given fields: botUserId, data

func (*API) SetProfileImage

func (_m *API) SetProfileImage(userId string, data []byte) *model.AppError

SetProfileImage provides a mock function with given fields: userId, data

func (*API) SetTeamIcon

func (_m *API) SetTeamIcon(teamId string, data []byte) *model.AppError

SetTeamIcon provides a mock function with given fields: teamId, data

func (*API) UnregisterCommand

func (_m *API) UnregisterCommand(teamId string, trigger string) error

UnregisterCommand provides a mock function with given fields: teamId, trigger

func (*API) UpdateBotActive

func (_m *API) UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError)

UpdateBotActive provides a mock function with given fields: botUserId, active

func (*API) UpdateChannel

func (_m *API) UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)

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) UpdateCommand

func (_m *API) UpdateCommand(commandID string, updatedCmd *model.Command) (*model.Command, error)

UpdateCommand provides a mock function with given fields: commandID, updatedCmd

func (*API) UpdateEphemeralPost

func (_m *API) UpdateEphemeralPost(userId string, post *model.Post) *model.Post

UpdateEphemeralPost provides a mock function with given fields: userId, post

func (*API) UpdatePost

func (_m *API) UpdatePost(post *model.Post) (*model.Post, *model.AppError)

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

func (_m *API) UpdateTeam(team *model.Team) (*model.Team, *model.AppError)

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

func (_m *API) UpdateUser(user *model.User) (*model.User, *model.AppError)

UpdateUser provides a mock function with given fields: user

func (*API) UpdateUserActive

func (_m *API) UpdateUserActive(userId string, active bool) *model.AppError

UpdateUserActive provides a mock function with given fields: userId, active

func (*API) UpdateUserStatus

func (_m *API) UpdateUserStatus(userId string, status string) (*model.Status, *model.AppError)

UpdateUserStatus provides a mock function with given fields: userId, status

func (*API) UploadFile

func (_m *API) UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)

UploadFile provides a mock function with given fields: data, channelId, filename

type Helpers

type Helpers struct {
	mock.Mock
}

Helpers is an autogenerated mock type for the Helpers type

func (*Helpers) CheckRequiredServerConfiguration

func (_m *Helpers) CheckRequiredServerConfiguration(req *model.Config) (bool, error)

CheckRequiredServerConfiguration provides a mock function with given fields: req

func (*Helpers) EnsureBot

func (_m *Helpers) EnsureBot(bot *model.Bot, options ...plugin.EnsureBotOption) (string, error)

EnsureBot provides a mock function with given fields: bot, options

func (*Helpers) GetPluginAssetURL

func (_m *Helpers) GetPluginAssetURL(pluginID string, asset string) (string, error)

GetPluginAssetURL provides a mock function with given fields: pluginID, asset

func (*Helpers) InstallPluginFromURL

func (_m *Helpers) InstallPluginFromURL(downloadURL string, replace bool) (*model.Manifest, error)

InstallPluginFromURL provides a mock function with given fields: downloadURL, replace

func (*Helpers) KVCompareAndDeleteJSON

func (_m *Helpers) KVCompareAndDeleteJSON(key string, oldValue interface{}) (bool, error)

KVCompareAndDeleteJSON provides a mock function with given fields: key, oldValue

func (*Helpers) KVCompareAndSetJSON

func (_m *Helpers) KVCompareAndSetJSON(key string, oldValue interface{}, newValue interface{}) (bool, error)

KVCompareAndSetJSON provides a mock function with given fields: key, oldValue, newValue

func (*Helpers) KVGetJSON

func (_m *Helpers) KVGetJSON(key string, value interface{}) (bool, error)

KVGetJSON provides a mock function with given fields: key, value

func (*Helpers) KVListWithOptions

func (_m *Helpers) KVListWithOptions(options ...plugin.KVListOption) ([]string, error)

KVListWithOptions provides a mock function with given fields: options

func (*Helpers) KVSetJSON

func (_m *Helpers) KVSetJSON(key string, value interface{}) error

KVSetJSON provides a mock function with given fields: key, value

func (*Helpers) KVSetWithExpiryJSON

func (_m *Helpers) KVSetWithExpiryJSON(key string, value interface{}, expireInSeconds int64) error

KVSetWithExpiryJSON provides a mock function with given fields: key, value, expireInSeconds

func (*Helpers) ShouldProcessMessage

func (_m *Helpers) ShouldProcessMessage(post *model.Post, options ...plugin.ShouldProcessMessageOption) (bool, error)

ShouldProcessMessage provides a mock function with given fields: post, options

type Hooks

type Hooks struct {
	mock.Mock
}

Hooks is an autogenerated mock type for the Hooks type

func (*Hooks) ChannelHasBeenCreated

func (_m *Hooks) ChannelHasBeenCreated(c *plugin.Context, channel *model.Channel)

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

func (_m *Hooks) Implemented() ([]string, error)

Implemented provides a mock function with given fields:

func (*Hooks) MessageHasBeenPosted

func (_m *Hooks) MessageHasBeenPosted(c *plugin.Context, post *model.Post)

MessageHasBeenPosted provides a mock function with given fields: c, post

func (*Hooks) MessageHasBeenUpdated

func (_m *Hooks) MessageHasBeenUpdated(c *plugin.Context, newPost *model.Post, oldPost *model.Post)

MessageHasBeenUpdated provides a mock function with given fields: c, newPost, oldPost

func (*Hooks) MessageWillBePosted

func (_m *Hooks) MessageWillBePosted(c *plugin.Context, post *model.Post) (*model.Post, string)

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

func (_m *Hooks) OnActivate() error

OnActivate provides a mock function with given fields:

func (*Hooks) OnConfigurationChange

func (_m *Hooks) OnConfigurationChange() error

OnConfigurationChange provides a mock function with given fields:

func (*Hooks) OnDeactivate

func (_m *Hooks) OnDeactivate() error

OnDeactivate provides a mock function with given fields:

func (*Hooks) ReactionHasBeenAdded

func (_m *Hooks) ReactionHasBeenAdded(c *plugin.Context, reaction *model.Reaction)

ReactionHasBeenAdded provides a mock function with given fields: c, reaction

func (*Hooks) ReactionHasBeenRemoved

func (_m *Hooks) ReactionHasBeenRemoved(c *plugin.Context, reaction *model.Reaction)

ReactionHasBeenRemoved provides a mock function with given fields: c, reaction

func (*Hooks) ServeHTTP

func (_m *Hooks) ServeHTTP(c *plugin.Context, w http.ResponseWriter, r *http.Request)

ServeHTTP provides a mock function with given fields: c, w, r

func (*Hooks) UserHasBeenCreated

func (_m *Hooks) UserHasBeenCreated(c *plugin.Context, user *model.User)

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

func (_m *Hooks) UserHasLoggedIn(c *plugin.Context, user *model.User)

UserHasLoggedIn provides a mock function with given fields: c, user

func (*Hooks) UserWillLogIn

func (_m *Hooks) UserWillLogIn(c *plugin.Context, user *model.User) string

UserWillLogIn provides a mock function with given fields: c, user

Directories

Path Synopsis
This package provides aliases for the contents of "github.com/stretchr/testify/mock".
This package provides aliases for the contents of "github.com/stretchr/testify/mock".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL