Documentation
¶
Index ¶
- type DatastoreMock
- func (mock *DatastoreMock) AddFilterDimension(ctx context.Context, s string, dimension model.Dimension) error
- func (mock *DatastoreMock) AddFilterDimensionCalls() []struct{ ... }
- func (mock *DatastoreMock) AddFilterOutputEvent(contextMoqParam context.Context, s string, event *model.Event) error
- func (mock *DatastoreMock) AddFilterOutputEventCalls() []struct{ ... }
- func (mock *DatastoreMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
- func (mock *DatastoreMock) CheckerCalls() []struct{ ... }
- func (mock *DatastoreMock) Conn() *mongo.MongoConnection
- func (mock *DatastoreMock) ConnCalls() []struct{}
- func (mock *DatastoreMock) CreateFilter(contextMoqParam context.Context, filter *model.Filter) error
- func (mock *DatastoreMock) CreateFilterCalls() []struct{ ... }
- func (mock *DatastoreMock) CreateFilterOutput(contextMoqParam context.Context, filterOutput *model.FilterOutput) error
- func (mock *DatastoreMock) CreateFilterOutputCalls() []struct{ ... }
- func (mock *DatastoreMock) DeleteFilterDimension(contextMoqParam context.Context, s1 string, s2 string) (string, error)
- func (mock *DatastoreMock) DeleteFilterDimensionCalls() []struct{ ... }
- func (mock *DatastoreMock) DeleteFilterDimensionOptions(contextMoqParam context.Context, s1 string, s2 string) (string, error)
- func (mock *DatastoreMock) DeleteFilterDimensionOptionsCalls() []struct{ ... }
- func (mock *DatastoreMock) GetFilter(contextMoqParam context.Context, s string) (*model.Filter, error)
- func (mock *DatastoreMock) GetFilterCalls() []struct{ ... }
- func (mock *DatastoreMock) GetFilterDimension(ctx context.Context, fID string, dimName string) (model.Dimension, error)
- func (mock *DatastoreMock) GetFilterDimensionCalls() []struct{ ... }
- func (mock *DatastoreMock) GetFilterDimensionOptions(contextMoqParam context.Context, s1 string, s2 string, n1 int, n2 int) ([]string, int, string, error)
- func (mock *DatastoreMock) GetFilterDimensionOptionsCalls() []struct{ ... }
- func (mock *DatastoreMock) GetFilterDimensions(contextMoqParam context.Context, s string, n1 int, n2 int) ([]model.Dimension, int, error)
- func (mock *DatastoreMock) GetFilterDimensionsCalls() []struct{ ... }
- func (mock *DatastoreMock) GetFilterOutput(contextMoqParam context.Context, s string) (*model.FilterOutput, error)
- func (mock *DatastoreMock) GetFilterOutputCalls() []struct{ ... }
- func (mock *DatastoreMock) RemoveFilterDimensionOption(ctx context.Context, filterID string, dimension string, option string, ...) (string, error)
- func (mock *DatastoreMock) RemoveFilterDimensionOptionCalls() []struct{ ... }
- func (mock *DatastoreMock) UpdateFilterDimension(ctx context.Context, filterID string, dimensionName string, ...) (string, error)
- func (mock *DatastoreMock) UpdateFilterDimensionCalls() []struct{ ... }
- func (mock *DatastoreMock) UpdateFilterOutput(contextMoqParam context.Context, filterOutput *model.FilterOutput) error
- func (mock *DatastoreMock) UpdateFilterOutputCalls() []struct{ ... }
- type GeneratorMock
- func (mock *GeneratorMock) PSK() ([]byte, error)
- func (mock *GeneratorMock) PSKCalls() []struct{}
- func (mock *GeneratorMock) Timestamp() time.Time
- func (mock *GeneratorMock) TimestampCalls() []struct{}
- func (mock *GeneratorMock) URL(host string, path string, args ...interface{}) string
- func (mock *GeneratorMock) URLCalls() []struct{ ... }
- func (mock *GeneratorMock) UUID() (uuid.UUID, error)
- func (mock *GeneratorMock) UUIDCalls() []struct{}
- func (mock *GeneratorMock) UniqueTimestamp() primitive.Timestamp
- func (mock *GeneratorMock) UniqueTimestampCalls() []struct{}
- type HTTPServerMock
- type HealthCheckerMock
- func (mock *HealthCheckerMock) AddAndGetCheck(name string, checker healthcheck.Checker) (*healthcheck.Check, error)
- func (mock *HealthCheckerMock) AddAndGetCheckCalls() []struct{ ... }
- func (mock *HealthCheckerMock) Handler(responseWriter http.ResponseWriter, request *http.Request)
- func (mock *HealthCheckerMock) HandlerCalls() []struct{ ... }
- func (mock *HealthCheckerMock) Start(contextMoqParam context.Context)
- func (mock *HealthCheckerMock) StartCalls() []struct{ ... }
- func (mock *HealthCheckerMock) Stop()
- func (mock *HealthCheckerMock) StopCalls() []struct{}
- func (mock *HealthCheckerMock) Subscribe(subscriber healthcheck.Subscriber, checks ...*healthcheck.Check)
- func (mock *HealthCheckerMock) SubscribeCalls() []struct{ ... }
- type ResponderMock
- func (mock *ResponderMock) Bytes(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, ...)
- func (mock *ResponderMock) BytesCalls() []struct{ ... }
- func (mock *ResponderMock) Error(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, ...)
- func (mock *ResponderMock) ErrorCalls() []struct{ ... }
- func (mock *ResponderMock) Errors(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, ...)
- func (mock *ResponderMock) ErrorsCalls() []struct{ ... }
- func (mock *ResponderMock) JSON(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, ...)
- func (mock *ResponderMock) JSONCalls() []struct{ ... }
- func (mock *ResponderMock) StatusCode(responseWriter http.ResponseWriter, n int)
- func (mock *ResponderMock) StatusCodeCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatastoreMock ¶
type DatastoreMock struct { // AddFilterDimensionFunc mocks the AddFilterDimension method. AddFilterDimensionFunc func(ctx context.Context, s string, dimension model.Dimension) error // AddFilterOutputEventFunc mocks the AddFilterOutputEvent method. AddFilterOutputEventFunc func(contextMoqParam context.Context, s string, event *model.Event) error // CheckerFunc mocks the Checker method. CheckerFunc func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error // ConnFunc mocks the Conn method. ConnFunc func() *mongo.MongoConnection // CreateFilterFunc mocks the CreateFilter method. CreateFilterFunc func(contextMoqParam context.Context, filter *model.Filter) error // CreateFilterOutputFunc mocks the CreateFilterOutput method. CreateFilterOutputFunc func(contextMoqParam context.Context, filterOutput *model.FilterOutput) error // DeleteFilterDimensionFunc mocks the DeleteFilterDimension method. DeleteFilterDimensionFunc func(contextMoqParam context.Context, s1 string, s2 string) (string, error) // DeleteFilterDimensionOptionsFunc mocks the DeleteFilterDimensionOptions method. DeleteFilterDimensionOptionsFunc func(contextMoqParam context.Context, s1 string, s2 string) (string, error) // GetFilterFunc mocks the GetFilter method. GetFilterFunc func(contextMoqParam context.Context, s string) (*model.Filter, error) // GetFilterDimensionFunc mocks the GetFilterDimension method. GetFilterDimensionFunc func(ctx context.Context, fID string, dimName string) (model.Dimension, error) // GetFilterDimensionOptionsFunc mocks the GetFilterDimensionOptions method. GetFilterDimensionOptionsFunc func(contextMoqParam context.Context, s1 string, s2 string, n1 int, n2 int) ([]string, int, string, error) // GetFilterDimensionsFunc mocks the GetFilterDimensions method. GetFilterDimensionsFunc func(contextMoqParam context.Context, s string, n1 int, n2 int) ([]model.Dimension, int, error) // GetFilterOutputFunc mocks the GetFilterOutput method. GetFilterOutputFunc func(contextMoqParam context.Context, s string) (*model.FilterOutput, error) // RemoveFilterDimensionOptionFunc mocks the RemoveFilterDimensionOption method. RemoveFilterDimensionOptionFunc func(ctx context.Context, filterID string, dimension string, option string, currentETag string) (string, error) // UpdateFilterDimensionFunc mocks the UpdateFilterDimension method. UpdateFilterDimensionFunc func(ctx context.Context, filterID string, dimensionName string, dimension model.Dimension, currentETag string) (string, error) // UpdateFilterOutputFunc mocks the UpdateFilterOutput method. UpdateFilterOutputFunc func(contextMoqParam context.Context, filterOutput *model.FilterOutput) error // contains filtered or unexported fields }
DatastoreMock is a mock implementation of service.Datastore.
func TestSomethingThatUsesDatastore(t *testing.T) { // make and configure a mocked service.Datastore mockedDatastore := &DatastoreMock{ AddFilterDimensionFunc: func(ctx context.Context, s string, dimension model.Dimension) error { panic("mock out the AddFilterDimension method") }, AddFilterOutputEventFunc: func(contextMoqParam context.Context, s string, event *model.Event) error { panic("mock out the AddFilterOutputEvent method") }, CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error { panic("mock out the Checker method") }, ConnFunc: func() *mongo.MongoConnection { panic("mock out the Conn method") }, CreateFilterFunc: func(contextMoqParam context.Context, filter *model.Filter) error { panic("mock out the CreateFilter method") }, CreateFilterOutputFunc: func(contextMoqParam context.Context, filterOutput *model.FilterOutput) error { panic("mock out the CreateFilterOutput method") }, DeleteFilterDimensionFunc: func(contextMoqParam context.Context, s1 string, s2 string) (string, error) { panic("mock out the DeleteFilterDimension method") }, DeleteFilterDimensionOptionsFunc: func(contextMoqParam context.Context, s1 string, s2 string) (string, error) { panic("mock out the DeleteFilterDimensionOptions method") }, GetFilterFunc: func(contextMoqParam context.Context, s string) (*model.Filter, error) { panic("mock out the GetFilter method") }, GetFilterDimensionFunc: func(ctx context.Context, fID string, dimName string) (model.Dimension, error) { panic("mock out the GetFilterDimension method") }, GetFilterDimensionOptionsFunc: func(contextMoqParam context.Context, s1 string, s2 string, n1 int, n2 int) ([]string, int, string, error) { panic("mock out the GetFilterDimensionOptions method") }, GetFilterDimensionsFunc: func(contextMoqParam context.Context, s string, n1 int, n2 int) ([]model.Dimension, int, error) { panic("mock out the GetFilterDimensions method") }, GetFilterOutputFunc: func(contextMoqParam context.Context, s string) (*model.FilterOutput, error) { panic("mock out the GetFilterOutput method") }, RemoveFilterDimensionOptionFunc: func(ctx context.Context, filterID string, dimension string, option string, currentETag string) (string, error) { panic("mock out the RemoveFilterDimensionOption method") }, UpdateFilterDimensionFunc: func(ctx context.Context, filterID string, dimensionName string, dimension model.Dimension, currentETag string) (string, error) { panic("mock out the UpdateFilterDimension method") }, UpdateFilterOutputFunc: func(contextMoqParam context.Context, filterOutput *model.FilterOutput) error { panic("mock out the UpdateFilterOutput method") }, } // use mockedDatastore in code that requires service.Datastore // and then make assertions. }
func (*DatastoreMock) AddFilterDimension ¶
func (mock *DatastoreMock) AddFilterDimension(ctx context.Context, s string, dimension model.Dimension) error
AddFilterDimension calls AddFilterDimensionFunc.
func (*DatastoreMock) AddFilterDimensionCalls ¶
func (mock *DatastoreMock) AddFilterDimensionCalls() []struct { Ctx context.Context S string Dimension model.Dimension }
AddFilterDimensionCalls gets all the calls that were made to AddFilterDimension. Check the length with:
len(mockedDatastore.AddFilterDimensionCalls())
func (*DatastoreMock) AddFilterOutputEvent ¶ added in v1.2.0
func (mock *DatastoreMock) AddFilterOutputEvent(contextMoqParam context.Context, s string, event *model.Event) error
AddFilterOutputEvent calls AddFilterOutputEventFunc.
func (*DatastoreMock) AddFilterOutputEventCalls ¶ added in v1.2.0
func (mock *DatastoreMock) AddFilterOutputEventCalls() []struct { ContextMoqParam context.Context S string Event *model.Event }
AddFilterOutputEventCalls gets all the calls that were made to AddFilterOutputEvent. Check the length with:
len(mockedDatastore.AddFilterOutputEventCalls())
func (*DatastoreMock) Checker ¶
func (mock *DatastoreMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
Checker calls CheckerFunc.
func (*DatastoreMock) CheckerCalls ¶
func (mock *DatastoreMock) CheckerCalls() []struct { ContextMoqParam context.Context CheckState *healthcheck.CheckState }
CheckerCalls gets all the calls that were made to Checker. Check the length with:
len(mockedDatastore.CheckerCalls())
func (*DatastoreMock) Conn ¶
func (mock *DatastoreMock) Conn() *mongo.MongoConnection
Conn calls ConnFunc.
func (*DatastoreMock) ConnCalls ¶
func (mock *DatastoreMock) ConnCalls() []struct { }
ConnCalls gets all the calls that were made to Conn. Check the length with:
len(mockedDatastore.ConnCalls())
func (*DatastoreMock) CreateFilter ¶
func (mock *DatastoreMock) CreateFilter(contextMoqParam context.Context, filter *model.Filter) error
CreateFilter calls CreateFilterFunc.
func (*DatastoreMock) CreateFilterCalls ¶
func (mock *DatastoreMock) CreateFilterCalls() []struct { ContextMoqParam context.Context Filter *model.Filter }
CreateFilterCalls gets all the calls that were made to CreateFilter. Check the length with:
len(mockedDatastore.CreateFilterCalls())
func (*DatastoreMock) CreateFilterOutput ¶
func (mock *DatastoreMock) CreateFilterOutput(contextMoqParam context.Context, filterOutput *model.FilterOutput) error
CreateFilterOutput calls CreateFilterOutputFunc.
func (*DatastoreMock) CreateFilterOutputCalls ¶
func (mock *DatastoreMock) CreateFilterOutputCalls() []struct { ContextMoqParam context.Context FilterOutput *model.FilterOutput }
CreateFilterOutputCalls gets all the calls that were made to CreateFilterOutput. Check the length with:
len(mockedDatastore.CreateFilterOutputCalls())
func (*DatastoreMock) DeleteFilterDimension ¶ added in v1.6.0
func (mock *DatastoreMock) DeleteFilterDimension(contextMoqParam context.Context, s1 string, s2 string) (string, error)
DeleteFilterDimension calls DeleteFilterDimensionFunc.
func (*DatastoreMock) DeleteFilterDimensionCalls ¶ added in v1.6.0
func (mock *DatastoreMock) DeleteFilterDimensionCalls() []struct { ContextMoqParam context.Context S1 string S2 string }
DeleteFilterDimensionCalls gets all the calls that were made to DeleteFilterDimension. Check the length with:
len(mockedDatastore.DeleteFilterDimensionCalls())
func (*DatastoreMock) DeleteFilterDimensionOptions ¶ added in v1.2.0
func (mock *DatastoreMock) DeleteFilterDimensionOptions(contextMoqParam context.Context, s1 string, s2 string) (string, error)
DeleteFilterDimensionOptions calls DeleteFilterDimensionOptionsFunc.
func (*DatastoreMock) DeleteFilterDimensionOptionsCalls ¶ added in v1.2.0
func (mock *DatastoreMock) DeleteFilterDimensionOptionsCalls() []struct { ContextMoqParam context.Context S1 string S2 string }
DeleteFilterDimensionOptionsCalls gets all the calls that were made to DeleteFilterDimensionOptions. Check the length with:
len(mockedDatastore.DeleteFilterDimensionOptionsCalls())
func (*DatastoreMock) GetFilter ¶
func (mock *DatastoreMock) GetFilter(contextMoqParam context.Context, s string) (*model.Filter, error)
GetFilter calls GetFilterFunc.
func (*DatastoreMock) GetFilterCalls ¶
func (mock *DatastoreMock) GetFilterCalls() []struct { ContextMoqParam context.Context S string }
GetFilterCalls gets all the calls that were made to GetFilter. Check the length with:
len(mockedDatastore.GetFilterCalls())
func (*DatastoreMock) GetFilterDimension ¶ added in v1.2.0
func (mock *DatastoreMock) GetFilterDimension(ctx context.Context, fID string, dimName string) (model.Dimension, error)
GetFilterDimension calls GetFilterDimensionFunc.
func (*DatastoreMock) GetFilterDimensionCalls ¶ added in v1.2.0
func (mock *DatastoreMock) GetFilterDimensionCalls() []struct { Ctx context.Context FID string DimName string }
GetFilterDimensionCalls gets all the calls that were made to GetFilterDimension. Check the length with:
len(mockedDatastore.GetFilterDimensionCalls())
func (*DatastoreMock) GetFilterDimensionOptions ¶ added in v1.2.0
func (mock *DatastoreMock) GetFilterDimensionOptions(contextMoqParam context.Context, s1 string, s2 string, n1 int, n2 int) ([]string, int, string, error)
GetFilterDimensionOptions calls GetFilterDimensionOptionsFunc.
func (*DatastoreMock) GetFilterDimensionOptionsCalls ¶ added in v1.2.0
func (mock *DatastoreMock) GetFilterDimensionOptionsCalls() []struct { ContextMoqParam context.Context S1 string S2 string N1 int N2 int }
GetFilterDimensionOptionsCalls gets all the calls that were made to GetFilterDimensionOptions. Check the length with:
len(mockedDatastore.GetFilterDimensionOptionsCalls())
func (*DatastoreMock) GetFilterDimensions ¶
func (mock *DatastoreMock) GetFilterDimensions(contextMoqParam context.Context, s string, n1 int, n2 int) ([]model.Dimension, int, error)
GetFilterDimensions calls GetFilterDimensionsFunc.
func (*DatastoreMock) GetFilterDimensionsCalls ¶
func (mock *DatastoreMock) GetFilterDimensionsCalls() []struct { ContextMoqParam context.Context S string N1 int N2 int }
GetFilterDimensionsCalls gets all the calls that were made to GetFilterDimensions. Check the length with:
len(mockedDatastore.GetFilterDimensionsCalls())
func (*DatastoreMock) GetFilterOutput ¶ added in v1.2.0
func (mock *DatastoreMock) GetFilterOutput(contextMoqParam context.Context, s string) (*model.FilterOutput, error)
GetFilterOutput calls GetFilterOutputFunc.
func (*DatastoreMock) GetFilterOutputCalls ¶ added in v1.2.0
func (mock *DatastoreMock) GetFilterOutputCalls() []struct { ContextMoqParam context.Context S string }
GetFilterOutputCalls gets all the calls that were made to GetFilterOutput. Check the length with:
len(mockedDatastore.GetFilterOutputCalls())
func (*DatastoreMock) RemoveFilterDimensionOption ¶ added in v1.2.0
func (mock *DatastoreMock) RemoveFilterDimensionOption(ctx context.Context, filterID string, dimension string, option string, currentETag string) (string, error)
RemoveFilterDimensionOption calls RemoveFilterDimensionOptionFunc.
func (*DatastoreMock) RemoveFilterDimensionOptionCalls ¶ added in v1.2.0
func (mock *DatastoreMock) RemoveFilterDimensionOptionCalls() []struct { Ctx context.Context FilterID string Dimension string Option string CurrentETag string }
RemoveFilterDimensionOptionCalls gets all the calls that were made to RemoveFilterDimensionOption. Check the length with:
len(mockedDatastore.RemoveFilterDimensionOptionCalls())
func (*DatastoreMock) UpdateFilterDimension ¶ added in v1.2.0
func (mock *DatastoreMock) UpdateFilterDimension(ctx context.Context, filterID string, dimensionName string, dimension model.Dimension, currentETag string) (string, error)
UpdateFilterDimension calls UpdateFilterDimensionFunc.
func (*DatastoreMock) UpdateFilterDimensionCalls ¶ added in v1.2.0
func (mock *DatastoreMock) UpdateFilterDimensionCalls() []struct { Ctx context.Context FilterID string DimensionName string Dimension model.Dimension CurrentETag string }
UpdateFilterDimensionCalls gets all the calls that were made to UpdateFilterDimension. Check the length with:
len(mockedDatastore.UpdateFilterDimensionCalls())
func (*DatastoreMock) UpdateFilterOutput ¶ added in v1.2.0
func (mock *DatastoreMock) UpdateFilterOutput(contextMoqParam context.Context, filterOutput *model.FilterOutput) error
UpdateFilterOutput calls UpdateFilterOutputFunc.
func (*DatastoreMock) UpdateFilterOutputCalls ¶ added in v1.2.0
func (mock *DatastoreMock) UpdateFilterOutputCalls() []struct { ContextMoqParam context.Context FilterOutput *model.FilterOutput }
UpdateFilterOutputCalls gets all the calls that were made to UpdateFilterOutput. Check the length with:
len(mockedDatastore.UpdateFilterOutputCalls())
type GeneratorMock ¶
type GeneratorMock struct { // PSKFunc mocks the PSK method. PSKFunc func() ([]byte, error) // TimestampFunc mocks the Timestamp method. TimestampFunc func() time.Time // URLFunc mocks the URL method. URLFunc func(host string, path string, args ...interface{}) string // UUIDFunc mocks the UUID method. UUIDFunc func() (uuid.UUID, error) // UniqueTimestampFunc mocks the UniqueTimestamp method. UniqueTimestampFunc func() primitive.Timestamp // contains filtered or unexported fields }
GeneratorMock is a mock implementation of service.Generator.
func TestSomethingThatUsesGenerator(t *testing.T) { // make and configure a mocked service.Generator mockedGenerator := &GeneratorMock{ PSKFunc: func() ([]byte, error) { panic("mock out the PSK method") }, TimestampFunc: func() time.Time { panic("mock out the Timestamp method") }, URLFunc: func(host string, path string, args ...interface{}) string { panic("mock out the URL method") }, UUIDFunc: func() (uuid.UUID, error) { panic("mock out the UUID method") }, UniqueTimestampFunc: func() primitive.Timestamp { panic("mock out the UniqueTimestamp method") }, } // use mockedGenerator in code that requires service.Generator // and then make assertions. }
func (*GeneratorMock) PSKCalls ¶
func (mock *GeneratorMock) PSKCalls() []struct { }
PSKCalls gets all the calls that were made to PSK. Check the length with:
len(mockedGenerator.PSKCalls())
func (*GeneratorMock) Timestamp ¶
func (mock *GeneratorMock) Timestamp() time.Time
Timestamp calls TimestampFunc.
func (*GeneratorMock) TimestampCalls ¶
func (mock *GeneratorMock) TimestampCalls() []struct { }
TimestampCalls gets all the calls that were made to Timestamp. Check the length with:
len(mockedGenerator.TimestampCalls())
func (*GeneratorMock) URL ¶
func (mock *GeneratorMock) URL(host string, path string, args ...interface{}) string
URL calls URLFunc.
func (*GeneratorMock) URLCalls ¶
func (mock *GeneratorMock) URLCalls() []struct { Host string Path string Args []interface{} }
URLCalls gets all the calls that were made to URL. Check the length with:
len(mockedGenerator.URLCalls())
func (*GeneratorMock) UUID ¶
func (mock *GeneratorMock) UUID() (uuid.UUID, error)
UUID calls UUIDFunc.
func (*GeneratorMock) UUIDCalls ¶
func (mock *GeneratorMock) UUIDCalls() []struct { }
UUIDCalls gets all the calls that were made to UUID. Check the length with:
len(mockedGenerator.UUIDCalls())
func (*GeneratorMock) UniqueTimestamp ¶
func (mock *GeneratorMock) UniqueTimestamp() primitive.Timestamp
UniqueTimestamp calls UniqueTimestampFunc.
func (*GeneratorMock) UniqueTimestampCalls ¶
func (mock *GeneratorMock) UniqueTimestampCalls() []struct { }
UniqueTimestampCalls gets all the calls that were made to UniqueTimestamp. Check the length with:
len(mockedGenerator.UniqueTimestampCalls())
type HTTPServerMock ¶
type HTTPServerMock struct { // ListenAndServeFunc mocks the ListenAndServe method. ListenAndServeFunc func() error // ShutdownFunc mocks the Shutdown method. ShutdownFunc func(ctx context.Context) error // contains filtered or unexported fields }
HTTPServerMock is a mock implementation of service.HTTPServer.
func TestSomethingThatUsesHTTPServer(t *testing.T) { // make and configure a mocked service.HTTPServer mockedHTTPServer := &HTTPServerMock{ ListenAndServeFunc: func() error { panic("mock out the ListenAndServe method") }, ShutdownFunc: func(ctx context.Context) error { panic("mock out the Shutdown method") }, } // use mockedHTTPServer in code that requires service.HTTPServer // and then make assertions. }
func (*HTTPServerMock) ListenAndServe ¶
func (mock *HTTPServerMock) ListenAndServe() error
ListenAndServe calls ListenAndServeFunc.
func (*HTTPServerMock) ListenAndServeCalls ¶
func (mock *HTTPServerMock) ListenAndServeCalls() []struct { }
ListenAndServeCalls gets all the calls that were made to ListenAndServe. Check the length with:
len(mockedHTTPServer.ListenAndServeCalls())
func (*HTTPServerMock) Shutdown ¶
func (mock *HTTPServerMock) Shutdown(ctx context.Context) error
Shutdown calls ShutdownFunc.
func (*HTTPServerMock) ShutdownCalls ¶
func (mock *HTTPServerMock) ShutdownCalls() []struct { Ctx context.Context }
ShutdownCalls gets all the calls that were made to Shutdown. Check the length with:
len(mockedHTTPServer.ShutdownCalls())
type HealthCheckerMock ¶
type HealthCheckerMock struct { // AddAndGetCheckFunc mocks the AddAndGetCheck method. AddAndGetCheckFunc func(name string, checker healthcheck.Checker) (*healthcheck.Check, error) // HandlerFunc mocks the Handler method. HandlerFunc func(responseWriter http.ResponseWriter, request *http.Request) // StartFunc mocks the Start method. StartFunc func(contextMoqParam context.Context) // StopFunc mocks the Stop method. StopFunc func() // SubscribeFunc mocks the Subscribe method. SubscribeFunc func(subscriber healthcheck.Subscriber, checks ...*healthcheck.Check) // contains filtered or unexported fields }
HealthCheckerMock is a mock implementation of service.HealthChecker.
func TestSomethingThatUsesHealthChecker(t *testing.T) { // make and configure a mocked service.HealthChecker mockedHealthChecker := &HealthCheckerMock{ AddAndGetCheckFunc: func(name string, checker healthcheck.Checker) (*healthcheck.Check, error) { panic("mock out the AddAndGetCheck method") }, HandlerFunc: func(responseWriter http.ResponseWriter, request *http.Request) { panic("mock out the Handler method") }, StartFunc: func(contextMoqParam context.Context) { panic("mock out the Start method") }, StopFunc: func() { panic("mock out the Stop method") }, SubscribeFunc: func(subscriber healthcheck.Subscriber, checks ...*healthcheck.Check) { panic("mock out the Subscribe method") }, } // use mockedHealthChecker in code that requires service.HealthChecker // and then make assertions. }
func (*HealthCheckerMock) AddAndGetCheck ¶
func (mock *HealthCheckerMock) AddAndGetCheck(name string, checker healthcheck.Checker) (*healthcheck.Check, error)
AddAndGetCheck calls AddAndGetCheckFunc.
func (*HealthCheckerMock) AddAndGetCheckCalls ¶
func (mock *HealthCheckerMock) AddAndGetCheckCalls() []struct { Name string Checker healthcheck.Checker }
AddAndGetCheckCalls gets all the calls that were made to AddAndGetCheck. Check the length with:
len(mockedHealthChecker.AddAndGetCheckCalls())
func (*HealthCheckerMock) Handler ¶
func (mock *HealthCheckerMock) Handler(responseWriter http.ResponseWriter, request *http.Request)
Handler calls HandlerFunc.
func (*HealthCheckerMock) HandlerCalls ¶
func (mock *HealthCheckerMock) HandlerCalls() []struct { ResponseWriter http.ResponseWriter Request *http.Request }
HandlerCalls gets all the calls that were made to Handler. Check the length with:
len(mockedHealthChecker.HandlerCalls())
func (*HealthCheckerMock) Start ¶
func (mock *HealthCheckerMock) Start(contextMoqParam context.Context)
Start calls StartFunc.
func (*HealthCheckerMock) StartCalls ¶
func (mock *HealthCheckerMock) StartCalls() []struct { ContextMoqParam context.Context }
StartCalls gets all the calls that were made to Start. Check the length with:
len(mockedHealthChecker.StartCalls())
func (*HealthCheckerMock) StopCalls ¶
func (mock *HealthCheckerMock) StopCalls() []struct { }
StopCalls gets all the calls that were made to Stop. Check the length with:
len(mockedHealthChecker.StopCalls())
func (*HealthCheckerMock) Subscribe ¶
func (mock *HealthCheckerMock) Subscribe(subscriber healthcheck.Subscriber, checks ...*healthcheck.Check)
Subscribe calls SubscribeFunc.
func (*HealthCheckerMock) SubscribeCalls ¶
func (mock *HealthCheckerMock) SubscribeCalls() []struct { Subscriber healthcheck.Subscriber Checks []*healthcheck.Check }
SubscribeCalls gets all the calls that were made to Subscribe. Check the length with:
len(mockedHealthChecker.SubscribeCalls())
type ResponderMock ¶
type ResponderMock struct { // BytesFunc mocks the Bytes method. BytesFunc func(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, bytes []byte) // ErrorFunc mocks the Error method. ErrorFunc func(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, err error) // ErrorsFunc mocks the Errors method. ErrorsFunc func(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, errs []error) // JSONFunc mocks the JSON method. JSONFunc func(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, ifaceVal interface{}) // StatusCodeFunc mocks the StatusCode method. StatusCodeFunc func(responseWriter http.ResponseWriter, n int) // contains filtered or unexported fields }
ResponderMock is a mock implementation of service.Responder.
func TestSomethingThatUsesResponder(t *testing.T) { // make and configure a mocked service.Responder mockedResponder := &ResponderMock{ BytesFunc: func(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, bytes []byte) { panic("mock out the Bytes method") }, ErrorFunc: func(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, err error) { panic("mock out the Error method") }, ErrorsFunc: func(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, errs []error) { panic("mock out the Errors method") }, JSONFunc: func(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, ifaceVal interface{}) { panic("mock out the JSON method") }, StatusCodeFunc: func(responseWriter http.ResponseWriter, n int) { panic("mock out the StatusCode method") }, } // use mockedResponder in code that requires service.Responder // and then make assertions. }
func (*ResponderMock) Bytes ¶
func (mock *ResponderMock) Bytes(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, bytes []byte)
Bytes calls BytesFunc.
func (*ResponderMock) BytesCalls ¶
func (mock *ResponderMock) BytesCalls() []struct { ContextMoqParam context.Context ResponseWriter http.ResponseWriter N int Bytes []byte }
BytesCalls gets all the calls that were made to Bytes. Check the length with:
len(mockedResponder.BytesCalls())
func (*ResponderMock) Error ¶
func (mock *ResponderMock) Error(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, err error)
Error calls ErrorFunc.
func (*ResponderMock) ErrorCalls ¶
func (mock *ResponderMock) ErrorCalls() []struct { ContextMoqParam context.Context ResponseWriter http.ResponseWriter N int Err error }
ErrorCalls gets all the calls that were made to Error. Check the length with:
len(mockedResponder.ErrorCalls())
func (*ResponderMock) Errors ¶
func (mock *ResponderMock) Errors(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, errs []error)
Errors calls ErrorsFunc.
func (*ResponderMock) ErrorsCalls ¶
func (mock *ResponderMock) ErrorsCalls() []struct { ContextMoqParam context.Context ResponseWriter http.ResponseWriter N int Errs []error }
ErrorsCalls gets all the calls that were made to Errors. Check the length with:
len(mockedResponder.ErrorsCalls())
func (*ResponderMock) JSON ¶
func (mock *ResponderMock) JSON(contextMoqParam context.Context, responseWriter http.ResponseWriter, n int, ifaceVal interface{})
JSON calls JSONFunc.
func (*ResponderMock) JSONCalls ¶
func (mock *ResponderMock) JSONCalls() []struct { ContextMoqParam context.Context ResponseWriter http.ResponseWriter N int IfaceVal interface{} }
JSONCalls gets all the calls that were made to JSON. Check the length with:
len(mockedResponder.JSONCalls())
func (*ResponderMock) StatusCode ¶
func (mock *ResponderMock) StatusCode(responseWriter http.ResponseWriter, n int)
StatusCode calls StatusCodeFunc.
func (*ResponderMock) StatusCodeCalls ¶
func (mock *ResponderMock) StatusCodeCalls() []struct { ResponseWriter http.ResponseWriter N int }
StatusCodeCalls gets all the calls that were made to StatusCode. Check the length with:
len(mockedResponder.StatusCodeCalls())