Documentation ¶
Index ¶
- type MongoDBMock
- func (mock *MongoDBMock) CheckTopicExists(ctx context.Context, id string) error
- func (mock *MongoDBMock) CheckTopicExistsCalls() []struct{ ... }
- func (mock *MongoDBMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
- func (mock *MongoDBMock) CheckerCalls() []struct{ ... }
- func (mock *MongoDBMock) Close(contextMoqParam context.Context) error
- func (mock *MongoDBMock) CloseCalls() []struct{ ... }
- func (mock *MongoDBMock) GetContent(ctx context.Context, id string, queryTypeFlags int) (*models.ContentResponse, error)
- func (mock *MongoDBMock) GetContentCalls() []struct{ ... }
- func (mock *MongoDBMock) GetTopic(ctx context.Context, id string) (*models.TopicResponse, error)
- func (mock *MongoDBMock) GetTopicCalls() []struct{ ... }
- type StorerMock
- func (mock *StorerMock) CheckTopicExists(ctx context.Context, id string) error
- func (mock *StorerMock) CheckTopicExistsCalls() []struct{ ... }
- func (mock *StorerMock) GetContent(ctx context.Context, id string, queryTypeFlags int) (*models.ContentResponse, error)
- func (mock *StorerMock) GetContentCalls() []struct{ ... }
- func (mock *StorerMock) GetTopic(ctx context.Context, id string) (*models.TopicResponse, error)
- func (mock *StorerMock) GetTopicCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoDBMock ¶
type MongoDBMock struct { // CheckTopicExistsFunc mocks the CheckTopicExists method. CheckTopicExistsFunc func(ctx context.Context, id string) error // CheckerFunc mocks the Checker method. CheckerFunc func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error // CloseFunc mocks the Close method. CloseFunc func(contextMoqParam context.Context) error // GetContentFunc mocks the GetContent method. GetContentFunc func(ctx context.Context, id string, queryTypeFlags int) (*models.ContentResponse, error) // GetTopicFunc mocks the GetTopic method. GetTopicFunc func(ctx context.Context, id string) (*models.TopicResponse, error) // contains filtered or unexported fields }
MongoDBMock is a mock implementation of store.MongoDB.
func TestSomethingThatUsesMongoDB(t *testing.T) { // make and configure a mocked store.MongoDB mockedMongoDB := &MongoDBMock{ CheckTopicExistsFunc: func(ctx context.Context, id string) error { panic("mock out the CheckTopicExists method") }, CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error { panic("mock out the Checker method") }, CloseFunc: func(contextMoqParam context.Context) error { panic("mock out the Close method") }, GetContentFunc: func(ctx context.Context, id string, queryTypeFlags int) (*models.ContentResponse, error) { panic("mock out the GetContent method") }, GetTopicFunc: func(ctx context.Context, id string) (*models.TopicResponse, error) { panic("mock out the GetTopic method") }, } // use mockedMongoDB in code that requires store.MongoDB // and then make assertions. }
func (*MongoDBMock) CheckTopicExists ¶ added in v0.4.0
func (mock *MongoDBMock) CheckTopicExists(ctx context.Context, id string) error
CheckTopicExists calls CheckTopicExistsFunc.
func (*MongoDBMock) CheckTopicExistsCalls ¶ added in v0.4.0
func (mock *MongoDBMock) CheckTopicExistsCalls() []struct { Ctx context.Context ID string }
CheckTopicExistsCalls gets all the calls that were made to CheckTopicExists. Check the length with:
len(mockedMongoDB.CheckTopicExistsCalls())
func (*MongoDBMock) Checker ¶
func (mock *MongoDBMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
Checker calls CheckerFunc.
func (*MongoDBMock) CheckerCalls ¶
func (mock *MongoDBMock) CheckerCalls() []struct { ContextMoqParam context.Context CheckState *healthcheck.CheckState }
CheckerCalls gets all the calls that were made to Checker. Check the length with:
len(mockedMongoDB.CheckerCalls())
func (*MongoDBMock) Close ¶
func (mock *MongoDBMock) Close(contextMoqParam context.Context) error
Close calls CloseFunc.
func (*MongoDBMock) CloseCalls ¶
func (mock *MongoDBMock) CloseCalls() []struct { ContextMoqParam context.Context }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedMongoDB.CloseCalls())
func (*MongoDBMock) GetContent ¶ added in v0.4.0
func (mock *MongoDBMock) GetContent(ctx context.Context, id string, queryTypeFlags int) (*models.ContentResponse, error)
GetContent calls GetContentFunc.
func (*MongoDBMock) GetContentCalls ¶ added in v0.4.0
func (mock *MongoDBMock) GetContentCalls() []struct { Ctx context.Context ID string QueryTypeFlags int }
GetContentCalls gets all the calls that were made to GetContent. Check the length with:
len(mockedMongoDB.GetContentCalls())
func (*MongoDBMock) GetTopic ¶
func (mock *MongoDBMock) GetTopic(ctx context.Context, id string) (*models.TopicResponse, error)
GetTopic calls GetTopicFunc.
func (*MongoDBMock) GetTopicCalls ¶
func (mock *MongoDBMock) GetTopicCalls() []struct { Ctx context.Context ID string }
GetTopicCalls gets all the calls that were made to GetTopic. Check the length with:
len(mockedMongoDB.GetTopicCalls())
type StorerMock ¶
type StorerMock struct { // CheckTopicExistsFunc mocks the CheckTopicExists method. CheckTopicExistsFunc func(ctx context.Context, id string) error // GetContentFunc mocks the GetContent method. GetContentFunc func(ctx context.Context, id string, queryTypeFlags int) (*models.ContentResponse, error) // GetTopicFunc mocks the GetTopic method. GetTopicFunc func(ctx context.Context, id string) (*models.TopicResponse, error) // contains filtered or unexported fields }
StorerMock is a mock implementation of store.Storer.
func TestSomethingThatUsesStorer(t *testing.T) { // make and configure a mocked store.Storer mockedStorer := &StorerMock{ CheckTopicExistsFunc: func(ctx context.Context, id string) error { panic("mock out the CheckTopicExists method") }, GetContentFunc: func(ctx context.Context, id string, queryTypeFlags int) (*models.ContentResponse, error) { panic("mock out the GetContent method") }, GetTopicFunc: func(ctx context.Context, id string) (*models.TopicResponse, error) { panic("mock out the GetTopic method") }, } // use mockedStorer in code that requires store.Storer // and then make assertions. }
func (*StorerMock) CheckTopicExists ¶ added in v0.4.0
func (mock *StorerMock) CheckTopicExists(ctx context.Context, id string) error
CheckTopicExists calls CheckTopicExistsFunc.
func (*StorerMock) CheckTopicExistsCalls ¶ added in v0.4.0
func (mock *StorerMock) CheckTopicExistsCalls() []struct { Ctx context.Context ID string }
CheckTopicExistsCalls gets all the calls that were made to CheckTopicExists. Check the length with:
len(mockedStorer.CheckTopicExistsCalls())
func (*StorerMock) GetContent ¶ added in v0.4.0
func (mock *StorerMock) GetContent(ctx context.Context, id string, queryTypeFlags int) (*models.ContentResponse, error)
GetContent calls GetContentFunc.
func (*StorerMock) GetContentCalls ¶ added in v0.4.0
func (mock *StorerMock) GetContentCalls() []struct { Ctx context.Context ID string QueryTypeFlags int }
GetContentCalls gets all the calls that were made to GetContent. Check the length with:
len(mockedStorer.GetContentCalls())
func (*StorerMock) GetTopic ¶
func (mock *StorerMock) GetTopic(ctx context.Context, id string) (*models.TopicResponse, error)
GetTopic calls GetTopicFunc.
func (*StorerMock) GetTopicCalls ¶
func (mock *StorerMock) GetTopicCalls() []struct { Ctx context.Context ID string }
GetTopicCalls gets all the calls that were made to GetTopic. Check the length with:
len(mockedStorer.GetTopicCalls())