Documentation
¶
Index ¶
- type AuthHandlerMock
- type CacheMock
- func (mock *CacheMock) DeleteAll() error
- func (mock *CacheMock) DeleteAllCalls() []struct{}
- func (mock *CacheMock) GetByEmail(email string) (*session.Session, error)
- func (mock *CacheMock) GetByEmailCalls() []struct{ ... }
- func (mock *CacheMock) GetByID(ID string) (*session.Session, error)
- func (mock *CacheMock) GetByIDCalls() []struct{ ... }
- func (mock *CacheMock) SetSession(s *session.Session) error
- func (mock *CacheMock) SetSessionCalls() []struct{ ... }
- type SessionUpdaterMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthHandlerMock ¶
type AuthHandlerMock struct {
// RequireFunc mocks the Require method.
RequireFunc func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
// contains filtered or unexported fields
}
AuthHandlerMock is a mock implementation of api.AuthHandler.
func TestSomethingThatUsesAuthHandler(t *testing.T) {
// make and configure a mocked api.AuthHandler
mockedAuthHandler := &AuthHandlerMock{
RequireFunc: func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc {
panic("mock out the Require method")
},
}
// use mockedAuthHandler in code that requires api.AuthHandler
// and then make assertions.
}
func (*AuthHandlerMock) Require ¶
func (mock *AuthHandlerMock) Require(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
Require calls RequireFunc.
func (*AuthHandlerMock) RequireCalls ¶
func (mock *AuthHandlerMock) RequireCalls() []struct { Required auth.Permissions Handler http.HandlerFunc }
RequireCalls gets all the calls that were made to Require. Check the length with:
len(mockedAuthHandler.RequireCalls())
type CacheMock ¶
type CacheMock struct {
// DeleteAllFunc mocks the DeleteAll method.
DeleteAllFunc func() error
// GetByEmailFunc mocks the GetByEmail method.
GetByEmailFunc func(email string) (*session.Session, error)
// GetByIDFunc mocks the GetByID method.
GetByIDFunc func(ID string) (*session.Session, error)
// SetSessionFunc mocks the SetSession method.
SetSessionFunc func(s *session.Session) error
// contains filtered or unexported fields
}
CacheMock is a mock implementation of api.Cache.
func TestSomethingThatUsesCache(t *testing.T) {
// make and configure a mocked api.Cache
mockedCache := &CacheMock{
DeleteAllFunc: func() error {
panic("mock out the DeleteAll method")
},
GetByEmailFunc: func(email string) (*session.Session, error) {
panic("mock out the GetByEmail method")
},
GetByIDFunc: func(ID string) (*session.Session, error) {
panic("mock out the GetByID method")
},
SetSessionFunc: func(s *session.Session) error {
panic("mock out the SetSession method")
},
}
// use mockedCache in code that requires api.Cache
// and then make assertions.
}
func (*CacheMock) DeleteAllCalls ¶
func (mock *CacheMock) DeleteAllCalls() []struct { }
DeleteAllCalls gets all the calls that were made to DeleteAll. Check the length with:
len(mockedCache.DeleteAllCalls())
func (*CacheMock) GetByEmail ¶ added in v1.0.0
GetByEmail calls GetByEmailFunc.
func (*CacheMock) GetByEmailCalls ¶ added in v1.0.0
GetByEmailCalls gets all the calls that were made to GetByEmail. Check the length with:
len(mockedCache.GetByEmailCalls())
func (*CacheMock) GetByIDCalls ¶
GetByIDCalls gets all the calls that were made to GetByID. Check the length with:
len(mockedCache.GetByIDCalls())
func (*CacheMock) SetSession ¶ added in v1.0.0
SetSession calls SetSessionFunc.
func (*CacheMock) SetSessionCalls ¶ added in v1.0.0
SetSessionCalls gets all the calls that were made to SetSession. Check the length with:
len(mockedCache.SetSessionCalls())
type SessionUpdaterMock ¶
type SessionUpdaterMock struct {
// UpdateFunc mocks the Update method.
UpdateFunc func(email string) (*session.Session, error)
// contains filtered or unexported fields
}
SessionUpdaterMock is a mock implementation of api.SessionUpdater.
func TestSomethingThatUsesSessionUpdater(t *testing.T) {
// make and configure a mocked api.SessionUpdater
mockedSessionUpdater := &SessionUpdaterMock{
UpdateFunc: func(email string) (*session.Session, error) {
panic("mock out the Update method")
},
}
// use mockedSessionUpdater in code that requires api.SessionUpdater
// and then make assertions.
}
func (*SessionUpdaterMock) Update ¶
func (mock *SessionUpdaterMock) Update(email string) (*session.Session, error)
Update calls UpdateFunc.
func (*SessionUpdaterMock) UpdateCalls ¶
func (mock *SessionUpdaterMock) UpdateCalls() []struct { Email string }
UpdateCalls gets all the calls that were made to Update. Check the length with:
len(mockedSessionUpdater.UpdateCalls())