Documentation ¶
Overview ¶
Package mocks defines implemented interfaces for testing modules
Index ¶
- func MockRequest(method string, postKeyValues ...string) *http.Request
- type MockAfterCallback
- type MockClientStorer
- type MockFailStorer
- type MockMailer
- type MockStorer
- func (m *MockStorer) AddToken(key, token string) error
- func (m *MockStorer) ConfirmUser(confirmToken string) (result interface{}, err error)
- func (m *MockStorer) Create(key string, attr authboss.Attributes) error
- func (m *MockStorer) DelTokens(key string) error
- func (m *MockStorer) Get(key string) (result interface{}, err error)
- func (m *MockStorer) GetOAuth(uid, provider string) (result interface{}, err error)
- func (m *MockStorer) Put(key string, attr authboss.Attributes) error
- func (m *MockStorer) PutOAuth(uid, provider string, attr authboss.Attributes) error
- func (m *MockStorer) RecoverUser(token string) (result interface{}, err error)
- func (m *MockStorer) UseToken(givenKey, token string) (err error)
- type MockUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MockAfterCallback ¶
type MockAfterCallback struct { HasBeenCalled bool Fn authboss.After }
MockAfterCallback is a callback that knows if it was called
func NewMockAfterCallback ¶
func NewMockAfterCallback() *MockAfterCallback
NewMockAfterCallback constructs a new mockaftercallback.
type MockClientStorer ¶
MockClientStorer is used for testing the client stores on context
func NewMockClientStorer ¶
func NewMockClientStorer(data ...string) *MockClientStorer
NewMockClientStorer constructs a MockClientStorer
func (*MockClientStorer) Get ¶
func (m *MockClientStorer) Get(key string) (string, bool)
Get a key's value
type MockFailStorer ¶
type MockFailStorer struct{}
MockFailStorer is used for testing module initialize functions that recover more than the base storer
func (MockFailStorer) Create ¶
func (_ MockFailStorer) Create(_ string, _ authboss.Attributes) error
Create fails
func (MockFailStorer) Put ¶
func (_ MockFailStorer) Put(_ string, _ authboss.Attributes) error
Put fails
type MockMailer ¶
type MockMailer struct { Last authboss.Email SendErr string }
MockMailer helps simplify mailer testing by storing the last sent email
type MockStorer ¶
type MockStorer struct { Users map[string]authboss.Attributes Tokens map[string][]string CreateErr string PutErr string GetErr string AddTokenErr string DelTokensErr string UseTokenErr string RecoverUserErr string ConfirmUserErr string }
MockStorer should be valid for any module storer defined in authboss.
func (*MockStorer) AddToken ¶
func (m *MockStorer) AddToken(key, token string) error
AddToken for remember me
func (*MockStorer) ConfirmUser ¶
func (m *MockStorer) ConfirmUser(confirmToken string) (result interface{}, err error)
ConfirmUser via their token
func (*MockStorer) Create ¶
func (m *MockStorer) Create(key string, attr authboss.Attributes) error
Create a new user
func (*MockStorer) DelTokens ¶
func (m *MockStorer) DelTokens(key string) error
DelTokens for a user
func (*MockStorer) Get ¶
func (m *MockStorer) Get(key string) (result interface{}, err error)
Get a user
func (*MockStorer) GetOAuth ¶
func (m *MockStorer) GetOAuth(uid, provider string) (result interface{}, err error)
GetOAuth user
func (*MockStorer) Put ¶
func (m *MockStorer) Put(key string, attr authboss.Attributes) error
Put updates to a user
func (*MockStorer) PutOAuth ¶
func (m *MockStorer) PutOAuth(uid, provider string, attr authboss.Attributes) error
PutOAuth user
func (*MockStorer) RecoverUser ¶
func (m *MockStorer) RecoverUser(token string) (result interface{}, err error)
RecoverUser by the token.
func (*MockStorer) UseToken ¶
func (m *MockStorer) UseToken(givenKey, token string) (err error)
UseToken if it exists, deleting it in the process
type MockUser ¶
type MockUser struct { Username string Email string Password string RecoverToken string RecoverTokenExpiry time.Time ConfirmToken string Confirmed bool Locked bool AttemptNumber int AttemptTime time.Time OauthToken string OauthRefresh string OauthExpiry time.Time }
MockUser represents all possible fields a authboss User may have