Documentation ¶
Overview ¶
Package fixtures provide testing fixtures
Index ¶
- func RandomString(length int) string
- type Ability
- type Account
- type BadOAuthProvider
- type MyRoleService
- type MyTokenService
- type MyUserService
- func (service *MyUserService) CreateOneByEmail(email string) (u gate.User, err error)
- func (service MyUserService) FindOneByEmail(email string) (u gate.User, err error)
- func (service MyUserService) FindOneByID(ID string) (u gate.User, err error)
- func (service *MyUserService) FindOrCreateOneByEmail(email string) (u gate.User, err error)
- type OAuthClient
- type OAuthProvider
- type Role
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomString ¶
RandomString return a random string of a given length
Types ¶
type Account ¶
Account contains login credentials
type BadOAuthProvider ¶
type BadOAuthProvider struct { NoClient bool NoResponse bool MalformedResponse bool OAuthProvider }
BadOAuthProvider is the mocking provider with no client for OAuth driver
func (BadOAuthProvider) Client ¶
func (config BadOAuthProvider) Client(ctx context.Context, token *oauth2.Token) internal.HTTPClient
Client returns an HTTP client using the provided token
type MyRoleService ¶
type MyRoleService struct {
// contains filtered or unexported fields
}
MyRoleService is my role service
func NewMyRoleService ¶
func NewMyRoleService(records []Role) *MyRoleService
NewMyRoleService is the constructor for MyRoleService
type MyTokenService ¶
type MyTokenService struct {
// contains filtered or unexported fields
}
MyTokenService is my token service
func NewMyTokenService ¶
func NewMyTokenService(records []token) *MyTokenService
NewMyTokenService is the constructor for MyTokenService
func (MyTokenService) Count ¶
func (service MyTokenService) Count() int
Count returns the number of records
func (MyTokenService) FindOneByID ¶
func (service MyTokenService) FindOneByID(id string) (jwt gate.JWT, err error)
FindOneByID fetches the JWT with the given ID
type MyUserService ¶
type MyUserService struct { GenerateMyUserID func() string // contains filtered or unexported fields }
MyUserService is my user service
func NewMyUserService ¶
func NewMyUserService(records []User) *MyUserService
NewMyUserService is the constructor for MyUserService
func (*MyUserService) CreateOneByEmail ¶
func (service *MyUserService) CreateOneByEmail(email string) (u gate.User, err error)
CreateOneByEmail creates the user with the given email
func (MyUserService) FindOneByEmail ¶
func (service MyUserService) FindOneByEmail(email string) (u gate.User, err error)
FindOneByEmail fetches the user with the given email
func (MyUserService) FindOneByID ¶
func (service MyUserService) FindOneByID(ID string) (u gate.User, err error)
FindOneByID fetches the user with the given ID
func (*MyUserService) FindOrCreateOneByEmail ¶
func (service *MyUserService) FindOrCreateOneByEmail(email string) (u gate.User, err error)
FindOrCreateOneByEmail fetches the user with the given email or creates a new one if the user doesn't exist
type OAuthClient ¶
type OAuthClient struct {
// contains filtered or unexported fields
}
OAuthClient is the mocking HTTP client for OAuth driver
type OAuthProvider ¶
OAuthProvider is the mocking provider for OAuth driver
func (OAuthProvider) AuthCodeURL ¶
func (config OAuthProvider) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
AuthCodeURL returns a URL to OAuth 2.0 provider's consent page
func (OAuthProvider) Client ¶
func (config OAuthProvider) Client(ctx context.Context, token *oauth2.Token) internal.HTTPClient
Client returns an HTTP client using the provided token
type Role ¶
Role is my user role
func (Role) GetAbilities ¶
func (r Role) GetAbilities() (abilities []gate.UserAbility)
GetAbilities returns role abilities