Documentation ¶
Index ¶
- Constants
- Variables
- func CheckBadRequestStatus(tb testing.TB, resp *model.Response)
- func CheckCreatedStatus(tb testing.TB, resp *model.Response)
- func CheckErrorID(tb testing.TB, err error, errorId string)
- func CheckErrorMessage(tb testing.TB, err error, message string)
- func CheckEtag(tb testing.TB, data interface{}, resp *model.Response)
- func CheckForbiddenStatus(tb testing.TB, resp *model.Response)
- func CheckInternalErrorStatus(tb testing.TB, resp *model.Response)
- func CheckNotFoundStatus(tb testing.TB, resp *model.Response)
- func CheckNotImplementedStatus(tb testing.TB, resp *model.Response)
- func CheckOKStatus(tb testing.TB, resp *model.Response)
- func CheckRequestEntityTooLargeStatus(tb testing.TB, resp *model.Response)
- func CheckServiceUnavailableStatus(tb testing.TB, resp *model.Response)
- func CheckStartsWith(tb testing.TB, value, prefix, message string)
- func CheckUnauthorizedStatus(tb testing.TB, resp *model.Response)
- func CheckUserSanitization(tb testing.TB, user *model.User)
- func GenerateTestAppName() string
- func GenerateTestChannelName() string
- func GenerateTestId() string
- func GenerateTestTeamName() string
- func GenerateTestUsername() string
- func Logout(c *Context, w http.ResponseWriter, r *http.Request)
- func SetMainHelper(mh *testlib.MainHelper)
- type API
- func (api *API) APIHandler(h handlerFunc) http.Handler
- func (api *API) APIHandlerTrustRequester(h handlerFunc) http.Handler
- func (api *API) APILocal(h handlerFunc) http.Handler
- func (api *API) APISessionRequired(h handlerFunc) http.Handler
- func (api *API) APISessionRequiredDisableWhenBusy(h handlerFunc) http.Handler
- func (api *API) APISessionRequiredMfa(h handlerFunc) http.Handler
- func (api *API) APISessionRequiredTrustRequester(h handlerFunc) http.Handler
- func (api *API) CloudAPIKeyRequired(h handlerFunc) http.Handler
- func (api *API) Handle404(w http.ResponseWriter, r *http.Request)
- func (api *API) InitAction()
- func (api *API) InitBleve()
- func (api *API) InitBot()
- func (api *API) InitBotLocal()
- func (api *API) InitBrand()
- func (api *API) InitChannel()
- func (api *API) InitChannelLocal()
- func (api *API) InitCloud()
- func (api *API) InitCluster()
- func (api *API) InitCommand()
- func (api *API) InitCommandLocal()
- func (api *API) InitCompliance()
- func (api *API) InitConfig()
- func (api *API) InitConfigLocal()
- func (api *API) InitDataRetention()
- func (api *API) InitElasticsearch()
- func (api *API) InitEmoji()
- func (api *API) InitExport()
- func (api *API) InitExportLocal()
- func (api *API) InitFile()
- func (api *API) InitGraphQL() error
- func (api *API) InitGroup()
- func (api *API) InitGroupLocal()
- func (api *API) InitImage()
- func (api *API) InitImport()
- func (api *API) InitImportLocal()
- func (api *API) InitJob()
- func (api *API) InitJobLocal()
- func (api *API) InitLdap()
- func (api *API) InitLdapLocal()
- func (api *API) InitLicense()
- func (api *API) InitLicenseLocal()
- func (api *API) InitOAuth()
- func (api *API) InitOpenGraph()
- func (api *API) InitPermissions()
- func (api *API) InitPlugin()
- func (api *API) InitPluginLocal()
- func (api *API) InitPost()
- func (api *API) InitPostLocal()
- func (api *API) InitPreference()
- func (api *API) InitReaction()
- func (api *API) InitRemoteCluster()
- func (api *API) InitRole()
- func (api *API) InitRoleLocal()
- func (api *API) InitSaml()
- func (api *API) InitSamlLocal()
- func (api *API) InitScheme()
- func (api *API) InitSharedChannels()
- func (api *API) InitStatus()
- func (api *API) InitSystem()
- func (api *API) InitSystemLocal()
- func (api *API) InitTeam()
- func (api *API) InitTeamLocal()
- func (api *API) InitTermsOfService()
- func (api *API) InitUpload()
- func (api *API) InitUploadLocal()
- func (api *API) InitUser()
- func (api *API) InitUserLocal()
- func (api *API) InitWebSocket()
- func (api *API) InitWebhook()
- func (api *API) InitWebhookLocal()
- func (api *API) RemoteClusterTokenRequired(h handlerFunc) http.Handler
- type Context
- type Routes
- type TestHelper
- func Setup(tb testing.TB) *TestHelper
- func SetupAndApplyConfigBeforeLogin(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelper
- func SetupConfig(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelper
- func SetupConfigWithStoreMock(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelper
- func SetupEnterprise(tb testing.TB) *TestHelper
- func SetupEnterpriseWithStoreMock(tb testing.TB) *TestHelper
- func SetupWithServerOptions(tb testing.TB, options []app.Option) *TestHelper
- func SetupWithStoreMock(tb testing.TB) *TestHelper
- func (th *TestHelper) AddPermissionToRole(permission string, roleName string)
- func (th *TestHelper) AddUserToChannel(user *model.User, channel *model.Channel) *model.ChannelMember
- func (th *TestHelper) CreateBotWithClient(client *model.Client4) *model.Bot
- func (th *TestHelper) CreateBotWithSystemAdminClient() *model.Bot
- func (th *TestHelper) CreateChannelWithClient(client *model.Client4, channelType model.ChannelType) *model.Channel
- func (th *TestHelper) CreateChannelWithClientAndTeam(client *model.Client4, channelType model.ChannelType, teamId string) *model.Channel
- func (th *TestHelper) CreateClient() *model.Client4
- func (th *TestHelper) CreateDmChannel(user *model.User) *model.Channel
- func (th *TestHelper) CreateGroup() *model.Group
- func (th *TestHelper) CreateLocalClient(socketPath string) *model.Client4
- func (th *TestHelper) CreateMessagePost(message string) *model.Post
- func (th *TestHelper) CreateMessagePostNoClient(channel *model.Channel, message string, createAtTime int64) *model.Post
- func (th *TestHelper) CreateMessagePostWithClient(client *model.Client4, channel *model.Channel, message string) *model.Post
- func (th *TestHelper) CreatePinnedPost() *model.Post
- func (th *TestHelper) CreatePinnedPostWithClient(client *model.Client4, channel *model.Channel) *model.Post
- func (th *TestHelper) CreatePost() *model.Post
- func (th *TestHelper) CreatePostInChannelWithFiles(channel *model.Channel, files ...*model.FileInfo) *model.Post
- func (th *TestHelper) CreatePostWithClient(client *model.Client4, channel *model.Channel) *model.Post
- func (th *TestHelper) CreatePostWithFiles(files ...*model.FileInfo) *model.Post
- func (th *TestHelper) CreatePostWithFilesWithClient(client *model.Client4, channel *model.Channel, files ...*model.FileInfo) *model.Post
- func (th *TestHelper) CreatePrivateChannel() *model.Channel
- func (th *TestHelper) CreatePublicChannel() *model.Channel
- func (th *TestHelper) CreateReliableWebSocketClient(connID string, seqNo int) (*model.WebSocketClient, error)
- func (th *TestHelper) CreateTeam() *model.Team
- func (th *TestHelper) CreateTeamWithClient(client *model.Client4) *model.Team
- func (th *TestHelper) CreateUser() *model.User
- func (th *TestHelper) CreateUserWithAuth(authService string) *model.User
- func (th *TestHelper) CreateUserWithClient(client *model.Client4) *model.User
- func (th *TestHelper) CreateWebSocketClient() (*model.WebSocketClient, error)
- func (th *TestHelper) CreateWebSocketClientWithClient(client *model.Client4) (*model.WebSocketClient, error)
- func (th *TestHelper) CreateWebSocketSystemAdminClient() (*model.WebSocketClient, error)
- func (th *TestHelper) CreateWebSocketSystemManagerClient() (*model.WebSocketClient, error)
- func (th *TestHelper) GenerateTestEmail() string
- func (th *TestHelper) InitBasic() *TestHelper
- func (th *TestHelper) InitLogin() *TestHelper
- func (th *TestHelper) LinkUserToTeam(user *model.User, team *model.Team)
- func (th *TestHelper) LoginBasic()
- func (th *TestHelper) LoginBasic2()
- func (th *TestHelper) LoginBasic2WithClient(client *model.Client4)
- func (th *TestHelper) LoginBasicWithClient(client *model.Client4)
- func (th *TestHelper) LoginBasicWithGraphQL()
- func (th *TestHelper) LoginSystemAdmin()
- func (th *TestHelper) LoginSystemAdminWithClient(client *model.Client4)
- func (th *TestHelper) LoginSystemManager()
- func (th *TestHelper) LoginSystemManagerWithClient(client *model.Client4)
- func (th *TestHelper) LoginTeamAdmin()
- func (th *TestHelper) LoginTeamAdminWithClient(client *model.Client4)
- func (th *TestHelper) MakeGraphQLRequest(input *graphQLInput) (*graphql.Response, error)
- func (th *TestHelper) MakeUserChannelAdmin(user *model.User, channel *model.Channel)
- func (th *TestHelper) RemovePermissionFromRole(permission string, roleName string)
- func (th *TestHelper) RemoveUserFromChannel(user *model.User, channel *model.Channel)
- func (th *TestHelper) RestoreDefaultRolePermissions(data map[string][]string)
- func (th *TestHelper) SaveDefaultRolePermissions() map[string][]string
- func (th *TestHelper) SetupChannelScheme() *model.Scheme
- func (th *TestHelper) SetupLdapConfig()
- func (th *TestHelper) SetupSamlConfig()
- func (th *TestHelper) SetupScheme(scope string) *model.Scheme
- func (th *TestHelper) SetupTeamScheme() *model.Scheme
- func (th *TestHelper) ShutdownApp()
- func (th *TestHelper) TearDown()
- func (th *TestHelper) TestForAllClients(t *testing.T, f func(*testing.T, *model.Client4), name ...string)
- func (th *TestHelper) TestForSystemAdminAndLocal(t *testing.T, f func(*testing.T, *model.Client4), name ...string)
- func (th *TestHelper) UnlinkUserFromTeam(user *model.User, team *model.Team)
- func (th *TestHelper) UpdateActiveUser(user *model.User, active bool)
- func (th *TestHelper) UpdateUserToNonTeamAdmin(user *model.User, team *model.Team)
- func (th *TestHelper) UpdateUserToTeamAdmin(user *model.User, team *model.Team)
Constants ¶
const ( FilterTypeWrite filterType = "write" FilterTypeRead filterType = "read" )
const ( FileTeamId = "noteam" PreviewImageType = "image/jpeg" ThumbnailImageType = "image/jpeg" )
const ( RedirectLocationCacheSize = 10000 DefaultServerBusySeconds = 3600 MaxServerBusySeconds = 86400 )
const ( MaxAddMembersBatch = 256 MaximumBulkImportSize = 10 * 1024 * 1024 )
const (
EmojiMaxAutocompleteItems = 100
)
const (
MaximumPluginFileSize = 50 * 1024 * 1024
)
Variables ¶
var MediaContentTypes = [...]string{
"image/jpeg",
"image/png",
"image/bmp",
"image/gif",
"image/tiff",
"video/avi",
"video/mpeg",
"video/mp4",
"audio/mpeg",
"audio/wav",
}
var ReturnStatusOK = web.ReturnStatusOK
var UnsafeContentTypes = [...]string{
"application/javascript",
"application/ecmascript",
"text/javascript",
"text/ecmascript",
"application/x-javascript",
"text/html",
}
Functions ¶
func CheckStartsWith ¶
func GenerateTestAppName ¶
func GenerateTestAppName() string
func GenerateTestChannelName ¶
func GenerateTestChannelName() string
func GenerateTestId ¶
func GenerateTestId() string
func GenerateTestTeamName ¶
func GenerateTestTeamName() string
func GenerateTestUsername ¶
func GenerateTestUsername() string
func SetMainHelper ¶
func SetMainHelper(mh *testlib.MainHelper)
Types ¶
type API ¶
type API struct { BaseRoutes *Routes // contains filtered or unexported fields }
func (*API) APIHandler ¶
APIHandler provides a handler for API endpoints which do not require the user to be logged in order for access to be granted.
func (*API) APIHandlerTrustRequester ¶
APIHandlerTrustRequester provides a handler for API endpoints which do not require the user to be logged in and are allowed to be requested directly rather than via javascript/XMLHttpRequest, such as site branding images or the websocket.
func (*API) APILocal ¶
APILocal provides a handler for API endpoints to be used in local mode, this is, through a UNIX socket and without an authenticated session, but with one that has no user set and no permission restrictions
func (*API) APISessionRequired ¶
APISessionRequired provides a handler for API endpoints which require the user to be logged in in order for access to be granted.
func (*API) APISessionRequiredDisableWhenBusy ¶
DisableWhenBusy provides a handler for API endpoints which should be disabled when the server is under load, responding with HTTP 503 (Service Unavailable).
func (*API) APISessionRequiredMfa ¶
APISessionRequiredMfa provides a handler for API endpoints which require a logged-in user session but when accessed, if MFA is enabled, the MFA process is not yet complete, and therefore the requirement to have completed the MFA authentication must be waived.
func (*API) APISessionRequiredTrustRequester ¶
APISessionRequiredTrustRequester provides a handler for API endpoints which do require the user to be logged in and are allowed to be requested directly rather than via javascript/XMLHttpRequest, such as emoji or file uploads.
func (*API) CloudAPIKeyRequired ¶
CloudAPIKeyRequired provides a handler for webhook endpoints to access Cloud installations from CWS
func (*API) InitAction ¶
func (api *API) InitAction()
func (*API) InitBotLocal ¶
func (api *API) InitBotLocal()
func (*API) InitChannel ¶
func (api *API) InitChannel()
func (*API) InitChannelLocal ¶
func (api *API) InitChannelLocal()
func (*API) InitCluster ¶
func (api *API) InitCluster()
func (*API) InitCommand ¶
func (api *API) InitCommand()
func (*API) InitCommandLocal ¶
func (api *API) InitCommandLocal()
func (*API) InitCompliance ¶
func (api *API) InitCompliance()
func (*API) InitConfig ¶
func (api *API) InitConfig()
func (*API) InitConfigLocal ¶
func (api *API) InitConfigLocal()
func (*API) InitDataRetention ¶
func (api *API) InitDataRetention()
func (*API) InitElasticsearch ¶
func (api *API) InitElasticsearch()
func (*API) InitExport ¶
func (api *API) InitExport()
func (*API) InitExportLocal ¶
func (api *API) InitExportLocal()
func (*API) InitGraphQL ¶ added in v6.5.0
func (*API) InitGroupLocal ¶
func (api *API) InitGroupLocal()
func (*API) InitImport ¶
func (api *API) InitImport()
func (*API) InitImportLocal ¶
func (api *API) InitImportLocal()
func (*API) InitJobLocal ¶
func (api *API) InitJobLocal()
func (*API) InitLdapLocal ¶
func (api *API) InitLdapLocal()
func (*API) InitLicense ¶
func (api *API) InitLicense()
func (*API) InitLicenseLocal ¶
func (api *API) InitLicenseLocal()
func (*API) InitOpenGraph ¶
func (api *API) InitOpenGraph()
func (*API) InitPermissions ¶
func (api *API) InitPermissions()
func (*API) InitPlugin ¶
func (api *API) InitPlugin()
func (*API) InitPluginLocal ¶
func (api *API) InitPluginLocal()
func (*API) InitPostLocal ¶
func (api *API) InitPostLocal()
func (*API) InitPreference ¶
func (api *API) InitPreference()
func (*API) InitReaction ¶
func (api *API) InitReaction()
func (*API) InitRemoteCluster ¶
func (api *API) InitRemoteCluster()
func (*API) InitRoleLocal ¶
func (api *API) InitRoleLocal()
func (*API) InitSamlLocal ¶
func (api *API) InitSamlLocal()
func (*API) InitScheme ¶
func (api *API) InitScheme()
func (*API) InitSharedChannels ¶
func (api *API) InitSharedChannels()
func (*API) InitStatus ¶
func (api *API) InitStatus()
func (*API) InitSystem ¶
func (api *API) InitSystem()
func (*API) InitSystemLocal ¶
func (api *API) InitSystemLocal()
func (*API) InitTeamLocal ¶
func (api *API) InitTeamLocal()
func (*API) InitTermsOfService ¶
func (api *API) InitTermsOfService()
func (*API) InitUpload ¶
func (api *API) InitUpload()
func (*API) InitUploadLocal ¶
func (api *API) InitUploadLocal()
func (*API) InitUserLocal ¶
func (api *API) InitUserLocal()
func (*API) InitWebSocket ¶
func (api *API) InitWebSocket()
func (*API) InitWebhook ¶
func (api *API) InitWebhook()
func (*API) InitWebhookLocal ¶
func (api *API) InitWebhookLocal()
func (*API) RemoteClusterTokenRequired ¶
RemoteClusterTokenRequired provides a handler for remote cluster requests to /remotecluster endpoints.
type Routes ¶
type Routes struct { Root *mux.Router // ” APIRoot *mux.Router // 'api/v4' APIRoot5 *mux.Router // 'api/v5' Users *mux.Router // 'api/v4/users' User *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}' UserByUsername *mux.Router // 'api/v4/users/username/{username:[A-Za-z0-9\\_\\-\\.]+}' UserByEmail *mux.Router // 'api/v4/users/email/{email:.+}' Bots *mux.Router // 'api/v4/bots' Bot *mux.Router // 'api/v4/bots/{bot_user_id:[A-Za-z0-9]+}' Teams *mux.Router // 'api/v4/teams' TeamsForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams' Team *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}' TeamForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/{team_id:[A-Za-z0-9]+}' UserThreads *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/{team_id:[A-Za-z0-9]+}/threads' UserThread *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/{team_id:[A-Za-z0-9]+}/threads/{thread_id:[A-Za-z0-9]+}' TeamByName *mux.Router // 'api/v4/teams/name/{team_name:[A-Za-z0-9_-]+}' TeamMembers *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/members' TeamMember *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/members/{user_id:[A-Za-z0-9]+}' TeamMembersForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/members' Channels *mux.Router // 'api/v4/channels' Channel *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}' ChannelForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/channels/{channel_id:[A-Za-z0-9]+}' ChannelByName *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/channels/name/{channel_name:[A-Za-z0-9_-]+}' ChannelByNameForTeamName *mux.Router // 'api/v4/teams/name/{team_name:[A-Za-z0-9_-]+}/channels/name/{channel_name:[A-Za-z0-9_-]+}' ChannelsForTeam *mux.Router // 'api/v4/teams/{team_id:[A-Za-z0-9]+}/channels' ChannelMembers *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/members' ChannelMember *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/members/{user_id:[A-Za-z0-9]+}' ChannelMembersForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/{team_id:[A-Za-z0-9]+}/channels/members' ChannelModerations *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/moderations' ChannelCategories *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/teams/{team_id:[A-Za-z0-9]+}/channels/categories' Posts *mux.Router // 'api/v4/posts' Post *mux.Router // 'api/v4/posts/{post_id:[A-Za-z0-9]+}' PostsForChannel *mux.Router // 'api/v4/channels/{channel_id:[A-Za-z0-9]+}/posts' PostsForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/posts' PostForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/posts/{post_id:[A-Za-z0-9]+}' Files *mux.Router // 'api/v4/files' File *mux.Router // 'api/v4/files/{file_id:[A-Za-z0-9]+}' Uploads *mux.Router // 'api/v4/uploads' Upload *mux.Router // 'api/v4/uploads/{upload_id:[A-Za-z0-9]+}' Plugins *mux.Router // 'api/v4/plugins' Plugin *mux.Router // 'api/v4/plugins/{plugin_id:[A-Za-z0-9\\_\\-\\.]+}' PublicFile *mux.Router // '/files/{file_id:[A-Za-z0-9]+}/public' Commands *mux.Router // 'api/v4/commands' Command *mux.Router // 'api/v4/commands/{command_id:[A-Za-z0-9]+}' Hooks *mux.Router // 'api/v4/hooks' IncomingHooks *mux.Router // 'api/v4/hooks/incoming' IncomingHook *mux.Router // 'api/v4/hooks/incoming/{hook_id:[A-Za-z0-9]+}' OutgoingHooks *mux.Router // 'api/v4/hooks/outgoing' OutgoingHook *mux.Router // 'api/v4/hooks/outgoing/{hook_id:[A-Za-z0-9]+}' OAuth *mux.Router // 'api/v4/oauth' OAuthApps *mux.Router // 'api/v4/oauth/apps' OAuthApp *mux.Router // 'api/v4/oauth/apps/{app_id:[A-Za-z0-9]+}' OpenGraph *mux.Router // 'api/v4/opengraph' SAML *mux.Router // 'api/v4/saml' Compliance *mux.Router // 'api/v4/compliance' Cluster *mux.Router // 'api/v4/cluster' Image *mux.Router // 'api/v4/image' LDAP *mux.Router // 'api/v4/ldap' Elasticsearch *mux.Router // 'api/v4/elasticsearch' Bleve *mux.Router // 'api/v4/bleve' DataRetention *mux.Router // 'api/v4/data_retention' Brand *mux.Router // 'api/v4/brand' System *mux.Router // 'api/v4/system' Jobs *mux.Router // 'api/v4/jobs' Preferences *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/preferences' License *mux.Router // 'api/v4/license' Public *mux.Router // 'api/v4/public' Reactions *mux.Router // 'api/v4/reactions' Roles *mux.Router // 'api/v4/roles' Schemes *mux.Router // 'api/v4/schemes' Emojis *mux.Router // 'api/v4/emoji' Emoji *mux.Router // 'api/v4/emoji/{emoji_id:[A-Za-z0-9]+}' EmojiByName *mux.Router // 'api/v4/emoji/name/{emoji_name:[A-Za-z0-9\\_\\-\\+]+}' ReactionByNameForPostForUser *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/posts/{post_id:[A-Za-z0-9]+}/reactions/{emoji_name:[A-Za-z0-9\\_\\-\\+]+}' TermsOfService *mux.Router // 'api/v4/terms_of_service' Groups *mux.Router // 'api/v4/groups' Cloud *mux.Router // 'api/v4/cloud' Imports *mux.Router // 'api/v4/imports' Exports *mux.Router // 'api/v4/exports' Export *mux.Router // 'api/v4/exports/{export_name:.+\\.zip}' RemoteCluster *mux.Router // 'api/v4/remotecluster' Permissions *mux.Router // 'api/v4/permissions' }
type TestHelper ¶
type TestHelper struct { App *app.App Server *app.Server ConfigStore *config.Store Context *request.Context Client *model.Client4 GraphQLClient *graphQLClient BasicUser *model.User BasicUser2 *model.User TeamAdminUser *model.User BasicTeam *model.Team BasicChannel *model.Channel BasicPrivateChannel *model.Channel BasicPrivateChannel2 *model.Channel BasicDeletedChannel *model.Channel BasicChannel2 *model.Channel BasicPost *model.Post Group *model.Group SystemAdminClient *model.Client4 SystemAdminUser *model.User SystemManagerClient *model.Client4 SystemManagerUser *model.User LocalClient *model.Client4 IncludeCacheLayer bool TestLogger *mlog.Logger // contains filtered or unexported fields }
func Setup ¶
func Setup(tb testing.TB) *TestHelper
func SetupAndApplyConfigBeforeLogin ¶ added in v6.4.0
func SetupAndApplyConfigBeforeLogin(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelper
func SetupConfig ¶
func SetupConfig(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelper
func SetupConfigWithStoreMock ¶
func SetupConfigWithStoreMock(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelper
func SetupEnterprise ¶
func SetupEnterprise(tb testing.TB) *TestHelper
func SetupEnterpriseWithStoreMock ¶
func SetupEnterpriseWithStoreMock(tb testing.TB) *TestHelper
func SetupWithServerOptions ¶
func SetupWithServerOptions(tb testing.TB, options []app.Option) *TestHelper
func SetupWithStoreMock ¶
func SetupWithStoreMock(tb testing.TB) *TestHelper
func (*TestHelper) AddPermissionToRole ¶
func (th *TestHelper) AddPermissionToRole(permission string, roleName string)
func (*TestHelper) AddUserToChannel ¶
func (th *TestHelper) AddUserToChannel(user *model.User, channel *model.Channel) *model.ChannelMember
func (*TestHelper) CreateBotWithClient ¶
func (th *TestHelper) CreateBotWithClient(client *model.Client4) *model.Bot
func (*TestHelper) CreateBotWithSystemAdminClient ¶
func (th *TestHelper) CreateBotWithSystemAdminClient() *model.Bot
func (*TestHelper) CreateChannelWithClient ¶
func (th *TestHelper) CreateChannelWithClient(client *model.Client4, channelType model.ChannelType) *model.Channel
func (*TestHelper) CreateChannelWithClientAndTeam ¶
func (th *TestHelper) CreateChannelWithClientAndTeam(client *model.Client4, channelType model.ChannelType, teamId string) *model.Channel
func (*TestHelper) CreateClient ¶
func (th *TestHelper) CreateClient() *model.Client4
func (*TestHelper) CreateDmChannel ¶
func (th *TestHelper) CreateDmChannel(user *model.User) *model.Channel
func (*TestHelper) CreateGroup ¶
func (th *TestHelper) CreateGroup() *model.Group
func (*TestHelper) CreateLocalClient ¶
func (th *TestHelper) CreateLocalClient(socketPath string) *model.Client4
ToDo: maybe move this to NewAPIv4SocketClient and reuse it in mmctl
func (*TestHelper) CreateMessagePost ¶
func (th *TestHelper) CreateMessagePost(message string) *model.Post
func (*TestHelper) CreateMessagePostNoClient ¶
func (*TestHelper) CreateMessagePostWithClient ¶
func (*TestHelper) CreatePinnedPost ¶
func (th *TestHelper) CreatePinnedPost() *model.Post
func (*TestHelper) CreatePinnedPostWithClient ¶
func (*TestHelper) CreatePost ¶
func (th *TestHelper) CreatePost() *model.Post
func (*TestHelper) CreatePostInChannelWithFiles ¶ added in v6.7.0
func (*TestHelper) CreatePostWithClient ¶
func (*TestHelper) CreatePostWithFiles ¶ added in v6.7.0
func (th *TestHelper) CreatePostWithFiles(files ...*model.FileInfo) *model.Post
func (*TestHelper) CreatePostWithFilesWithClient ¶ added in v6.7.0
func (*TestHelper) CreatePrivateChannel ¶
func (th *TestHelper) CreatePrivateChannel() *model.Channel
func (*TestHelper) CreatePublicChannel ¶
func (th *TestHelper) CreatePublicChannel() *model.Channel
func (*TestHelper) CreateReliableWebSocketClient ¶ added in v6.2.0
func (th *TestHelper) CreateReliableWebSocketClient(connID string, seqNo int) (*model.WebSocketClient, error)
func (*TestHelper) CreateTeam ¶
func (th *TestHelper) CreateTeam() *model.Team
func (*TestHelper) CreateTeamWithClient ¶
func (th *TestHelper) CreateTeamWithClient(client *model.Client4) *model.Team
func (*TestHelper) CreateUser ¶
func (th *TestHelper) CreateUser() *model.User
func (*TestHelper) CreateUserWithAuth ¶
func (th *TestHelper) CreateUserWithAuth(authService string) *model.User
func (*TestHelper) CreateUserWithClient ¶
func (th *TestHelper) CreateUserWithClient(client *model.Client4) *model.User
func (*TestHelper) CreateWebSocketClient ¶
func (th *TestHelper) CreateWebSocketClient() (*model.WebSocketClient, error)
func (*TestHelper) CreateWebSocketClientWithClient ¶
func (th *TestHelper) CreateWebSocketClientWithClient(client *model.Client4) (*model.WebSocketClient, error)
func (*TestHelper) CreateWebSocketSystemAdminClient ¶
func (th *TestHelper) CreateWebSocketSystemAdminClient() (*model.WebSocketClient, error)
func (*TestHelper) CreateWebSocketSystemManagerClient ¶
func (th *TestHelper) CreateWebSocketSystemManagerClient() (*model.WebSocketClient, error)
func (*TestHelper) GenerateTestEmail ¶
func (th *TestHelper) GenerateTestEmail() string
func (*TestHelper) InitBasic ¶
func (th *TestHelper) InitBasic() *TestHelper
func (*TestHelper) InitLogin ¶
func (th *TestHelper) InitLogin() *TestHelper
func (*TestHelper) LinkUserToTeam ¶
func (th *TestHelper) LinkUserToTeam(user *model.User, team *model.Team)
func (*TestHelper) LoginBasic ¶
func (th *TestHelper) LoginBasic()
func (*TestHelper) LoginBasic2 ¶
func (th *TestHelper) LoginBasic2()
func (*TestHelper) LoginBasic2WithClient ¶
func (th *TestHelper) LoginBasic2WithClient(client *model.Client4)
func (*TestHelper) LoginBasicWithClient ¶
func (th *TestHelper) LoginBasicWithClient(client *model.Client4)
func (*TestHelper) LoginBasicWithGraphQL ¶ added in v6.5.0
func (th *TestHelper) LoginBasicWithGraphQL()
func (*TestHelper) LoginSystemAdmin ¶
func (th *TestHelper) LoginSystemAdmin()
func (*TestHelper) LoginSystemAdminWithClient ¶
func (th *TestHelper) LoginSystemAdminWithClient(client *model.Client4)
func (*TestHelper) LoginSystemManager ¶
func (th *TestHelper) LoginSystemManager()
func (*TestHelper) LoginSystemManagerWithClient ¶
func (th *TestHelper) LoginSystemManagerWithClient(client *model.Client4)
func (*TestHelper) LoginTeamAdmin ¶
func (th *TestHelper) LoginTeamAdmin()
func (*TestHelper) LoginTeamAdminWithClient ¶
func (th *TestHelper) LoginTeamAdminWithClient(client *model.Client4)
func (*TestHelper) MakeGraphQLRequest ¶ added in v6.5.0
func (th *TestHelper) MakeGraphQLRequest(input *graphQLInput) (*graphql.Response, error)
func (*TestHelper) MakeUserChannelAdmin ¶
func (th *TestHelper) MakeUserChannelAdmin(user *model.User, channel *model.Channel)
func (*TestHelper) RemovePermissionFromRole ¶
func (th *TestHelper) RemovePermissionFromRole(permission string, roleName string)
func (*TestHelper) RemoveUserFromChannel ¶ added in v6.5.0
func (th *TestHelper) RemoveUserFromChannel(user *model.User, channel *model.Channel)
func (*TestHelper) RestoreDefaultRolePermissions ¶
func (th *TestHelper) RestoreDefaultRolePermissions(data map[string][]string)
func (*TestHelper) SaveDefaultRolePermissions ¶
func (th *TestHelper) SaveDefaultRolePermissions() map[string][]string
func (*TestHelper) SetupChannelScheme ¶
func (th *TestHelper) SetupChannelScheme() *model.Scheme
func (*TestHelper) SetupLdapConfig ¶
func (th *TestHelper) SetupLdapConfig()
func (*TestHelper) SetupSamlConfig ¶
func (th *TestHelper) SetupSamlConfig()
func (*TestHelper) SetupScheme ¶
func (th *TestHelper) SetupScheme(scope string) *model.Scheme
func (*TestHelper) SetupTeamScheme ¶
func (th *TestHelper) SetupTeamScheme() *model.Scheme
func (*TestHelper) ShutdownApp ¶
func (th *TestHelper) ShutdownApp()
func (*TestHelper) TearDown ¶
func (th *TestHelper) TearDown()
func (*TestHelper) TestForAllClients ¶
func (th *TestHelper) TestForAllClients(t *testing.T, f func(*testing.T, *model.Client4), name ...string)
TestForAllClients runs a test function for all the clients registered in the TestHelper
func (*TestHelper) TestForSystemAdminAndLocal ¶
func (th *TestHelper) TestForSystemAdminAndLocal(t *testing.T, f func(*testing.T, *model.Client4), name ...string)
TestForSystemAdminAndLocal runs a test function for both SystemAdmin and Local clients. Several endpoints work in the same way when used by a fully privileged user and through the local mode, so this helper facilitates checking both
func (*TestHelper) UnlinkUserFromTeam ¶ added in v6.5.0
func (th *TestHelper) UnlinkUserFromTeam(user *model.User, team *model.Team)
func (*TestHelper) UpdateActiveUser ¶
func (th *TestHelper) UpdateActiveUser(user *model.User, active bool)
func (*TestHelper) UpdateUserToNonTeamAdmin ¶
func (th *TestHelper) UpdateUserToNonTeamAdmin(user *model.User, team *model.Team)
func (*TestHelper) UpdateUserToTeamAdmin ¶
func (th *TestHelper) UpdateUserToTeamAdmin(user *model.User, team *model.Team)
Source Files ¶
- api.go
- apitestlib.go
- bleve.go
- bot.go
- bot_local.go
- brand.go
- channel.go
- channel_category.go
- channel_local.go
- cloud.go
- cluster.go
- command.go
- command_local.go
- compliance.go
- config.go
- config_local.go
- data_retention.go
- elasticsearch.go
- emoji.go
- export.go
- export_local.go
- file.go
- graphql.go
- graphql_client.go
- group.go
- group_local.go
- handlers.go
- helpers.go
- image.go
- import.go
- import_local.go
- integration_action.go
- job.go
- job_local.go
- ldap.go
- ldap_local.go
- license.go
- license_local.go
- oauth.go
- openGraph.go
- permission.go
- plugin.go
- plugin_local.go
- post.go
- post_local.go
- preference.go
- reaction.go
- remote_cluster.go
- resolver.go
- resolver_channel.go
- resolver_channel_member.go
- resolver_team.go
- resolver_team_member.go
- resolver_user.go
- role.go
- role_local.go
- saml.go
- scheme.go
- shared_channel.go
- status.go
- system.go
- system_local.go
- team.go
- team_local.go
- terms_of_service.go
- upload.go
- upload_local.go
- user.go
- user_local.go
- webhook.go
- webhook_local.go
- websocket.go