Documentation ¶
Index ¶
- Constants
- type HandlerOption
- type Server
- func (s *Server) APIKeysCreateCount() int
- func (s *Server) APIKeysDeleteCount(id string) int
- func (s *Server) APIKeysDetailCount(id string) int
- func (s *Server) APIKeysListCount() int
- func (s *Server) APIKeysPermissionsCount() int
- func (s *Server) APIKeysUpdateCount(id string) int
- func (s *Server) AccountUpdateCount(id string) int
- func (s *Server) AuthenticateCount() int
- func (s *Server) Close()
- func (s *Server) CreateAccessToken(claims *tokens.Claims) (string, error)
- func (s *Server) CreateTokenPair(claims *tokens.Claims) (string, string, error)
- func (s *Server) ForgotPasswordCount() int
- func (s *Server) InvitesAcceptCount() int
- func (s *Server) InvitesCreateCount() int
- func (s *Server) InvitesPreviewCount(token string) int
- func (s *Server) LoginCount() int
- func (s *Server) OnAPIKeysCreate(opts ...HandlerOption)
- func (s *Server) OnAPIKeysDelete(id string, opts ...HandlerOption)
- func (s *Server) OnAPIKeysDetail(id string, opts ...HandlerOption)
- func (s *Server) OnAPIKeysList(opts ...HandlerOption)
- func (s *Server) OnAPIKeysPermissions(opts ...HandlerOption)
- func (s *Server) OnAPIKeysUpdate(id string, opts ...HandlerOption)
- func (s *Server) OnAccountUpdate(id string, opts ...HandlerOption)
- func (s *Server) OnAuthenticate(opts ...HandlerOption)
- func (s *Server) OnForgotPassword(opts ...HandlerOption)
- func (s *Server) OnInvitesAccept(opts ...HandlerOption)
- func (s *Server) OnInvitesCreate(opts ...HandlerOption)
- func (s *Server) OnInvitesPreview(token string, opts ...HandlerOption)
- func (s *Server) OnLogin(opts ...HandlerOption)
- func (s *Server) OnOrganizations(param string, opts ...HandlerOption)
- func (s *Server) OnOrganizationsUpdate(id string, opts ...HandlerOption)
- func (s *Server) OnProjectsAccess(opts ...HandlerOption)
- func (s *Server) OnProjectsCreate(opts ...HandlerOption)
- func (s *Server) OnProjectsDetail(id string, opts ...HandlerOption)
- func (s *Server) OnProjectsList(opts ...HandlerOption)
- func (s *Server) OnRefresh(opts ...HandlerOption)
- func (s *Server) OnRegister(opts ...HandlerOption)
- func (s *Server) OnResendEmail(opts ...HandlerOption)
- func (s *Server) OnResetPassword(opts ...HandlerOption)
- func (s *Server) OnStatus(opts ...HandlerOption)
- func (s *Server) OnSwitch(opts ...HandlerOption)
- func (s *Server) OnUsersDetail(id string, opts ...HandlerOption)
- func (s *Server) OnUsersList(opts ...HandlerOption)
- func (s *Server) OnUsersRemove(id string, opts ...HandlerOption)
- func (s *Server) OnUsersRemoveConfirm(id string, opts ...HandlerOption)
- func (s *Server) OnUsersRoleUpdate(id string, opts ...HandlerOption)
- func (s *Server) OnUsersUpdate(id string, opts ...HandlerOption)
- func (s *Server) OnVerify(opts ...HandlerOption)
- func (s *Server) OnWorkspace(opts ...HandlerOption)
- func (s *Server) OrganizationsCount(param string) int
- func (s *Server) OrganizationsUpdateCount(id string) int
- func (s *Server) ProjectsAccessCount() int
- func (s *Server) ProjectsCreateCount() int
- func (s *Server) ProjectsDetailCount(id string) int
- func (s *Server) ProjectsListCount() int
- func (s *Server) RefreshCount() int
- func (s *Server) RegisterCount() int
- func (s *Server) ResendEmailCount() int
- func (s *Server) Reset()
- func (s *Server) ResetPasswordCount() int
- func (s *Server) StatusCount() int
- func (s *Server) SwitchCount() int
- func (s *Server) URL() string
- func (s *Server) UsersDetailCount(id string) int
- func (s *Server) UsersListCount() int
- func (s *Server) UsersRemoveConfirmCount(id string) int
- func (s *Server) UsersRemoveCount(id string) int
- func (s *Server) UsersRoleUpdateCount(id string) int
- func (s *Server) UsersUpdateCount(id string) int
- func (s *Server) VerifyCount() int
- func (s *Server) WorkspaceCount() int
Constants ¶
const ( StatusEP = "/v1/status" RegisterEP = "/v1/register" LoginEP = "/v1/login" AuthenticateEP = "/v1/authenticate" RefreshEP = "/v1/refresh" SwitchEP = "/v1/switch" VerifyEP = "/v1/verify" ResendEP = "/v1/resend" ForgotPasswordEP = "/v1/forgot-password" ResetPasswordEP = "/v1/reset-password" APIKeysEP = "/v1/apikeys" ProjectsEP = "/v1/projects" OrganizationsEP = "/v1/organizations" UsersEP = "/v1/users" InvitesEP = "/v1/invites" WorkspaceEP = "/v1/workspace" AccountsEP = "/v1/accounts" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerOption ¶
type HandlerOption func(*handlerOptions)
HandlerOption allows users of the mock to configure specific endpoint handler behavior or override it entirely.
func RequireAuth ¶ added in v0.3.0
func RequireAuth() HandlerOption
Return a 401 response if the request is not authenticated
func UseError ¶ added in v0.3.0
func UseError(status int, err string) HandlerOption
Configure a basic error reply to be returned by the handler
func UseHandler ¶
func UseHandler(f http.HandlerFunc) HandlerOption
Use the given handler, overriding all other options
func UseJSONFixture ¶
func UseJSONFixture(fixture interface{}) HandlerOption
Configure a JSON fixture to be returned by the handler
func UseStatus ¶
func UseStatus(status int) HandlerOption
Configure the status code to be returned by the handler
type Server ¶
Server embeds an httptest Server and provides additional methods for configuring mock responses and counting requests. By default handlers will panic, it's the responsibility of the test writer to configure the behavior of each handler that will be invoked by using the appropriate On* method and passing in the desired HandlerOption(s). If no HandlerOption is specified, the default behavior is to return a 200 OK response with an empty body.
func NewServer ¶
NewServer creates and starts a new mock server for testing Quarterdeck interactions.
func (*Server) APIKeysCreateCount ¶ added in v0.8.0
func (*Server) APIKeysDeleteCount ¶ added in v0.8.0
func (*Server) APIKeysDetailCount ¶ added in v0.8.0
func (*Server) APIKeysListCount ¶ added in v0.8.0
func (*Server) APIKeysPermissionsCount ¶ added in v0.8.0
func (*Server) APIKeysUpdateCount ¶ added in v0.8.0
func (*Server) AccountUpdateCount ¶ added in v0.10.0
func (*Server) AuthenticateCount ¶
func (*Server) CreateAccessToken ¶ added in v0.10.0
func (*Server) CreateTokenPair ¶ added in v0.10.0
func (*Server) ForgotPasswordCount ¶ added in v0.11.0
func (*Server) InvitesAcceptCount ¶ added in v0.10.0
func (*Server) InvitesCreateCount ¶ added in v0.8.0
func (*Server) InvitesPreviewCount ¶ added in v0.8.0
func (*Server) LoginCount ¶
func (*Server) OnAPIKeysCreate ¶ added in v0.8.0
func (s *Server) OnAPIKeysCreate(opts ...HandlerOption)
func (*Server) OnAPIKeysDelete ¶ added in v0.8.0
func (s *Server) OnAPIKeysDelete(id string, opts ...HandlerOption)
func (*Server) OnAPIKeysDetail ¶ added in v0.8.0
func (s *Server) OnAPIKeysDetail(id string, opts ...HandlerOption)
func (*Server) OnAPIKeysList ¶ added in v0.8.0
func (s *Server) OnAPIKeysList(opts ...HandlerOption)
func (*Server) OnAPIKeysPermissions ¶ added in v0.8.0
func (s *Server) OnAPIKeysPermissions(opts ...HandlerOption)
func (*Server) OnAPIKeysUpdate ¶ added in v0.8.0
func (s *Server) OnAPIKeysUpdate(id string, opts ...HandlerOption)
func (*Server) OnAccountUpdate ¶ added in v0.10.0
func (s *Server) OnAccountUpdate(id string, opts ...HandlerOption)
func (*Server) OnAuthenticate ¶
func (s *Server) OnAuthenticate(opts ...HandlerOption)
func (*Server) OnForgotPassword ¶ added in v0.11.0
func (s *Server) OnForgotPassword(opts ...HandlerOption)
func (*Server) OnInvitesAccept ¶ added in v0.10.0
func (s *Server) OnInvitesAccept(opts ...HandlerOption)
func (*Server) OnInvitesCreate ¶ added in v0.8.0
func (s *Server) OnInvitesCreate(opts ...HandlerOption)
func (*Server) OnInvitesPreview ¶ added in v0.8.0
func (s *Server) OnInvitesPreview(token string, opts ...HandlerOption)
func (*Server) OnLogin ¶
func (s *Server) OnLogin(opts ...HandlerOption)
func (*Server) OnOrganizations ¶ added in v0.4.0
func (s *Server) OnOrganizations(param string, opts ...HandlerOption)
func (*Server) OnOrganizationsUpdate ¶ added in v0.10.0
func (s *Server) OnOrganizationsUpdate(id string, opts ...HandlerOption)
func (*Server) OnProjectsAccess ¶ added in v0.8.0
func (s *Server) OnProjectsAccess(opts ...HandlerOption)
func (*Server) OnProjectsCreate ¶ added in v0.8.0
func (s *Server) OnProjectsCreate(opts ...HandlerOption)
func (*Server) OnProjectsDetail ¶ added in v0.8.0
func (s *Server) OnProjectsDetail(id string, opts ...HandlerOption)
func (*Server) OnProjectsList ¶ added in v0.8.0
func (s *Server) OnProjectsList(opts ...HandlerOption)
func (*Server) OnRefresh ¶
func (s *Server) OnRefresh(opts ...HandlerOption)
func (*Server) OnRegister ¶
func (s *Server) OnRegister(opts ...HandlerOption)
func (*Server) OnResendEmail ¶ added in v0.10.0
func (s *Server) OnResendEmail(opts ...HandlerOption)
func (*Server) OnResetPassword ¶ added in v0.11.0
func (s *Server) OnResetPassword(opts ...HandlerOption)
func (*Server) OnSwitch ¶ added in v0.5.2
func (s *Server) OnSwitch(opts ...HandlerOption)
func (*Server) OnUsersDetail ¶ added in v0.8.0
func (s *Server) OnUsersDetail(id string, opts ...HandlerOption)
func (*Server) OnUsersList ¶ added in v0.8.0
func (s *Server) OnUsersList(opts ...HandlerOption)
func (*Server) OnUsersRemove ¶ added in v0.8.0
func (s *Server) OnUsersRemove(id string, opts ...HandlerOption)
func (*Server) OnUsersRemoveConfirm ¶ added in v0.8.0
func (s *Server) OnUsersRemoveConfirm(id string, opts ...HandlerOption)
func (*Server) OnUsersRoleUpdate ¶ added in v0.8.0
func (s *Server) OnUsersRoleUpdate(id string, opts ...HandlerOption)
func (*Server) OnUsersUpdate ¶ added in v0.8.0
func (s *Server) OnUsersUpdate(id string, opts ...HandlerOption)
func (*Server) OnVerify ¶ added in v0.5.0
func (s *Server) OnVerify(opts ...HandlerOption)
func (*Server) OnWorkspace ¶ added in v0.10.0
func (s *Server) OnWorkspace(opts ...HandlerOption)