Documentation
¶
Index ¶
- type AuthHandlerMock
- type CacheMock
- func (mock *CacheMock) DeleteAll() error
- func (mock *CacheMock) DeleteAllCalls() []struct{}
- func (mock *CacheMock) GetByID(ID string) (*session.Session, error)
- func (mock *CacheMock) GetByIDCalls() []struct{ ... }
- func (mock *CacheMock) Set(s *session.Session) error
- func (mock *CacheMock) SetCalls() []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
// GetByIDFunc mocks the GetByID method.
GetByIDFunc func(ID string) (*session.Session, error)
// SetFunc mocks the Set method.
SetFunc 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")
},
GetByIDFunc: func(ID string) (*session.Session, error) {
panic("mock out the GetByID method")
},
SetFunc: func(s *session.Session) error {
panic("mock out the Set 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) GetByIDCalls ¶
GetByIDCalls gets all the calls that were made to GetByID. Check the length with:
len(mockedCache.GetByIDCalls())
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())
Click to show internal directories.
Click to hide internal directories.