Documentation ¶
Index ¶
- Constants
- Variables
- func CheckBadRequestStatus(t *testing.T, resp *model.Response)
- func CheckCreatedStatus(t *testing.T, resp *model.Response)
- func CheckErrorMessage(t *testing.T, resp *model.Response, errorId string)
- func CheckEtag(t *testing.T, data interface{}, resp *model.Response)
- func CheckForbiddenStatus(t *testing.T, resp *model.Response)
- func CheckInternalErrorStatus(t *testing.T, resp *model.Response)
- func CheckNoError(t *testing.T, resp *model.Response)
- func CheckNotFoundStatus(t *testing.T, resp *model.Response)
- func CheckNotImplementedStatus(t *testing.T, resp *model.Response)
- func CheckOKStatus(t *testing.T, resp *model.Response)
- func CheckRequestEntityTooLargeStatus(t *testing.T, resp *model.Response)
- func CheckUnauthorizedStatus(t *testing.T, resp *model.Response)
- func CheckUserSanitization(t *testing.T, 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 UseTestStore(store store.Store)
- type API
- func (api *API) ApiHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) ApiHandlerTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) ApiSessionRequired(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) ApiSessionRequiredMfa(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) ApiSessionRequiredTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
- func (api *API) Handle404(w http.ResponseWriter, r *http.Request)
- func (api *API) InitAction()
- func (api *API) InitBrand()
- func (api *API) InitChannel()
- func (api *API) InitCluster()
- func (api *API) InitCommand()
- func (api *API) InitCompliance()
- func (api *API) InitDataRetention()
- func (api *API) InitElasticsearch()
- func (api *API) InitEmoji()
- func (api *API) InitFile()
- func (api *API) InitGroup()
- func (api *API) InitImage()
- func (api *API) InitJob()
- func (api *API) InitLdap()
- func (api *API) InitOAuth()
- func (api *API) InitOpenGraph()
- func (api *API) InitPlugin()
- func (api *API) InitPost()
- func (api *API) InitPreference()
- func (api *API) InitReaction()
- func (api *API) InitRole()
- func (api *API) InitSaml()
- func (api *API) InitScheme()
- func (api *API) InitStatus()
- func (api *API) InitSystem()
- func (api *API) InitTeam()
- func (api *API) InitTermsOfService()
- func (api *API) InitUser()
- func (api *API) InitWebSocket()
- func (api *API) InitWebhook()
- type Context
- type Routes
- type TestHelper
- func (me *TestHelper) AddPermissionToRole(permission string, roleName string)
- func (me *TestHelper) AddUserToChannel(user *model.User, channel *model.Channel) *model.ChannelMember
- func (me *TestHelper) CreateChannelWithClient(client *model.Client4, channelType string) *model.Channel
- func (me *TestHelper) CreateChannelWithClientAndTeam(client *model.Client4, channelType string, teamId string) *model.Channel
- func (me *TestHelper) CreateClient() *model.Client4
- func (me *TestHelper) CreateDmChannel(user *model.User) *model.Channel
- func (me *TestHelper) CreateMessagePost(message string) *model.Post
- func (me *TestHelper) CreateMessagePostNoClient(channel *model.Channel, message string, createAtTime int64) *model.Post
- func (me *TestHelper) CreateMessagePostWithClient(client *model.Client4, channel *model.Channel, message string) *model.Post
- func (me *TestHelper) CreatePinnedPost() *model.Post
- func (me *TestHelper) CreatePinnedPostWithClient(client *model.Client4, channel *model.Channel) *model.Post
- func (me *TestHelper) CreatePost() *model.Post
- func (me *TestHelper) CreatePostWithClient(client *model.Client4, channel *model.Channel) *model.Post
- func (me *TestHelper) CreatePrivateChannel() *model.Channel
- func (me *TestHelper) CreatePublicChannel() *model.Channel
- func (me *TestHelper) CreateTeam() *model.Team
- func (me *TestHelper) CreateTeamWithClient(client *model.Client4) *model.Team
- func (me *TestHelper) CreateUser() *model.User
- func (me *TestHelper) CreateUserWithClient(client *model.Client4) *model.User
- func (me *TestHelper) CreateWebSocketClient() (*model.WebSocketClient, *model.AppError)
- func (me *TestHelper) CreateWebSocketSystemAdminClient() (*model.WebSocketClient, *model.AppError)
- func (me *TestHelper) GenerateTestEmail() string
- func (me *TestHelper) InitBasic() *TestHelper
- func (me *TestHelper) LinkUserToTeam(user *model.User, team *model.Team)
- func (me *TestHelper) LoginBasic()
- func (me *TestHelper) LoginBasic2()
- func (me *TestHelper) LoginBasic2WithClient(client *model.Client4)
- func (me *TestHelper) LoginBasicWithClient(client *model.Client4)
- func (me *TestHelper) LoginSystemAdmin()
- func (me *TestHelper) LoginSystemAdminWithClient(client *model.Client4)
- func (me *TestHelper) LoginTeamAdmin()
- func (me *TestHelper) LoginTeamAdminWithClient(client *model.Client4)
- func (me *TestHelper) MakeUserChannelAdmin(user *model.User, channel *model.Channel)
- func (me *TestHelper) RemovePermissionFromRole(permission string, roleName string)
- func (me *TestHelper) RestoreDefaultRolePermissions(data map[string][]string)
- func (me *TestHelper) SaveDefaultRolePermissions() map[string][]string
- func (me *TestHelper) ShutdownApp()
- func (me *TestHelper) TearDown()
- func (me *TestHelper) UpdateActiveUser(user *model.User, active bool)
- func (me *TestHelper) UpdateUserToNonTeamAdmin(user *model.User, team *model.Team)
- func (me *TestHelper) UpdateUserToTeamAdmin(user *model.User, team *model.Team)
Constants ¶
const ( FILE_TEAM_ID = "noteam" PREVIEW_IMAGE_TYPE = "image/jpeg" THUMBNAIL_IMAGE_TYPE = "image/jpeg" )
const ( MAX_ADD_MEMBERS_BATCH = 20 MAXIMUM_BULK_IMPORT_SIZE = 10 * 1024 * 1024 )
const (
EMOJI_MAX_AUTOCOMPLETE_ITEMS = 100
)
const (
MAXIMUM_PLUGIN_FILE_SIZE = 50 * 1024 * 1024
)
const OPEN_GRAPH_METADATA_CACHE_SIZE = 10000
const REDIRECT_LOCATION_CACHE_SIZE = 10000
Variables ¶
var MEDIA_CONTENT_TYPES = [...]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 UNSAFE_CONTENT_TYPES = [...]string{
"application/javascript",
"application/ecmascript",
"text/javascript",
"text/ecmascript",
"application/x-javascript",
"text/html",
}
Functions ¶
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 UseTestStore ¶
Types ¶
type API ¶
type API struct { ConfigService configservice.ConfigService GetGlobalAppOptions app.AppOptionCreator BaseRoutes *Routes }
func Init ¶
func Init(configservice configservice.ConfigService, globalOptionsFunc app.AppOptionCreator, root *mux.Router) *API
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 ¶
func (api *API) ApiHandlerTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
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) ApiSessionRequired ¶
func (api *API) ApiSessionRequired(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
ApiSessionRequired provides a handler for API endpoints which require the user to be logged in in order for access to be granted.
func (*API) ApiSessionRequiredMfa ¶
func (api *API) ApiSessionRequiredMfa(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
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 ¶
func (api *API) ApiSessionRequiredTrustRequester(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler
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) InitAction ¶
func (api *API) InitAction()
func (*API) InitChannel ¶
func (api *API) InitChannel()
func (*API) InitCluster ¶
func (api *API) InitCluster()
func (*API) InitCommand ¶
func (api *API) InitCommand()
func (*API) InitCompliance ¶
func (api *API) InitCompliance()
func (*API) InitDataRetention ¶
func (api *API) InitDataRetention()
func (*API) InitElasticsearch ¶
func (api *API) InitElasticsearch()
func (*API) InitOpenGraph ¶
func (api *API) InitOpenGraph()
func (*API) InitPlugin ¶
func (api *API) InitPlugin()
func (*API) InitPreference ¶
func (api *API) InitPreference()
func (*API) InitReaction ¶
func (api *API) InitReaction()
func (*API) InitScheme ¶
func (api *API) InitScheme()
func (*API) InitStatus ¶
func (api *API) InitStatus()
func (*API) InitSystem ¶
func (api *API) InitSystem()
func (*API) InitTermsOfService ¶
func (api *API) InitTermsOfService()
func (*API) InitWebSocket ¶
func (api *API) InitWebSocket()
func (*API) InitWebhook ¶
func (api *API) InitWebhook()
type Routes ¶
type Routes struct { Root *mux.Router // ” ApiRoot *mux.Router // 'api/v4' 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}' 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]+}' 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' 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]+}' 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' 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' }
type TestHelper ¶
type TestHelper struct { App *app.App Server *app.Server Client *model.Client4 BasicUser *model.User BasicUser2 *model.User TeamAdminUser *model.User BasicTeam *model.Team BasicChannel *model.Channel BasicPrivateChannel *model.Channel BasicDeletedChannel *model.Channel BasicChannel2 *model.Channel BasicPost *model.Post SystemAdminClient *model.Client4 SystemAdminUser *model.User // contains filtered or unexported fields }
func Setup ¶
func Setup() *TestHelper
func SetupConfig ¶
func SetupConfig(updateConfig func(cfg *model.Config)) *TestHelper
func SetupEnterprise ¶
func SetupEnterprise() *TestHelper
func (*TestHelper) AddPermissionToRole ¶
func (me *TestHelper) AddPermissionToRole(permission string, roleName string)
func (*TestHelper) AddUserToChannel ¶
func (me *TestHelper) AddUserToChannel(user *model.User, channel *model.Channel) *model.ChannelMember
func (*TestHelper) CreateChannelWithClient ¶
func (*TestHelper) CreateChannelWithClientAndTeam ¶
func (*TestHelper) CreateClient ¶
func (me *TestHelper) CreateClient() *model.Client4
func (*TestHelper) CreateDmChannel ¶
func (me *TestHelper) CreateDmChannel(user *model.User) *model.Channel
func (*TestHelper) CreateMessagePost ¶
func (me *TestHelper) CreateMessagePost(message string) *model.Post
func (*TestHelper) CreateMessagePostNoClient ¶
func (*TestHelper) CreateMessagePostWithClient ¶
func (*TestHelper) CreatePinnedPost ¶
func (me *TestHelper) CreatePinnedPost() *model.Post
func (*TestHelper) CreatePinnedPostWithClient ¶
func (*TestHelper) CreatePost ¶
func (me *TestHelper) CreatePost() *model.Post
func (*TestHelper) CreatePostWithClient ¶
func (*TestHelper) CreatePrivateChannel ¶
func (me *TestHelper) CreatePrivateChannel() *model.Channel
func (*TestHelper) CreatePublicChannel ¶
func (me *TestHelper) CreatePublicChannel() *model.Channel
func (*TestHelper) CreateTeam ¶
func (me *TestHelper) CreateTeam() *model.Team
func (*TestHelper) CreateTeamWithClient ¶
func (me *TestHelper) CreateTeamWithClient(client *model.Client4) *model.Team
func (*TestHelper) CreateUser ¶
func (me *TestHelper) CreateUser() *model.User
func (*TestHelper) CreateUserWithClient ¶
func (me *TestHelper) CreateUserWithClient(client *model.Client4) *model.User
func (*TestHelper) CreateWebSocketClient ¶
func (me *TestHelper) CreateWebSocketClient() (*model.WebSocketClient, *model.AppError)
func (*TestHelper) CreateWebSocketSystemAdminClient ¶
func (me *TestHelper) CreateWebSocketSystemAdminClient() (*model.WebSocketClient, *model.AppError)
func (*TestHelper) GenerateTestEmail ¶
func (me *TestHelper) GenerateTestEmail() string
func (*TestHelper) InitBasic ¶
func (me *TestHelper) InitBasic() *TestHelper
func (*TestHelper) LinkUserToTeam ¶
func (me *TestHelper) LinkUserToTeam(user *model.User, team *model.Team)
func (*TestHelper) LoginBasic ¶
func (me *TestHelper) LoginBasic()
func (*TestHelper) LoginBasic2 ¶
func (me *TestHelper) LoginBasic2()
func (*TestHelper) LoginBasic2WithClient ¶
func (me *TestHelper) LoginBasic2WithClient(client *model.Client4)
func (*TestHelper) LoginBasicWithClient ¶
func (me *TestHelper) LoginBasicWithClient(client *model.Client4)
func (*TestHelper) LoginSystemAdmin ¶
func (me *TestHelper) LoginSystemAdmin()
func (*TestHelper) LoginSystemAdminWithClient ¶
func (me *TestHelper) LoginSystemAdminWithClient(client *model.Client4)
func (*TestHelper) LoginTeamAdmin ¶
func (me *TestHelper) LoginTeamAdmin()
func (*TestHelper) LoginTeamAdminWithClient ¶
func (me *TestHelper) LoginTeamAdminWithClient(client *model.Client4)
func (*TestHelper) MakeUserChannelAdmin ¶
func (me *TestHelper) MakeUserChannelAdmin(user *model.User, channel *model.Channel)
func (*TestHelper) RemovePermissionFromRole ¶
func (me *TestHelper) RemovePermissionFromRole(permission string, roleName string)
func (*TestHelper) RestoreDefaultRolePermissions ¶
func (me *TestHelper) RestoreDefaultRolePermissions(data map[string][]string)
func (*TestHelper) SaveDefaultRolePermissions ¶
func (me *TestHelper) SaveDefaultRolePermissions() map[string][]string
func (*TestHelper) ShutdownApp ¶
func (me *TestHelper) ShutdownApp()
func (*TestHelper) TearDown ¶
func (me *TestHelper) TearDown()
func (*TestHelper) UpdateActiveUser ¶
func (me *TestHelper) UpdateActiveUser(user *model.User, active bool)
func (*TestHelper) UpdateUserToNonTeamAdmin ¶
func (me *TestHelper) UpdateUserToNonTeamAdmin(user *model.User, team *model.Team)
func (*TestHelper) UpdateUserToTeamAdmin ¶
func (me *TestHelper) UpdateUserToTeamAdmin(user *model.User, team *model.Team)
Source Files ¶
- api.go
- apitestlib.go
- brand.go
- channel.go
- cluster.go
- command.go
- compliance.go
- data_retention.go
- elasticsearch.go
- emoji.go
- file.go
- group.go
- handlers.go
- image.go
- integration_action.go
- job.go
- ldap.go
- oauth.go
- openGraph.go
- plugin.go
- post.go
- preference.go
- reaction.go
- role.go
- saml.go
- scheme.go
- status.go
- system.go
- team.go
- terms_of_service.go
- user.go
- webhook.go
- websocket.go