Documentation ¶
Index ¶
- type BigQueryClientMock
- type CacheServiceMock
- func (mock *CacheServiceMock) NewReader(ctx context.Context, ID model.QueryID) (io.ReadCloser, error)
- func (mock *CacheServiceMock) NewReaderCalls() []struct{ ... }
- func (mock *CacheServiceMock) NewWriter(ctx context.Context, ID model.QueryID) (io.WriteCloser, error)
- func (mock *CacheServiceMock) NewWriterCalls() []struct{ ... }
- func (mock *CacheServiceMock) String() string
- func (mock *CacheServiceMock) StringCalls() []struct{}
- type CloudStorageClientMock
- func (mock *CloudStorageClientMock) GetObject(ctx context.Context, bucketName string, objectName string) (io.ReadCloser, error)
- func (mock *CloudStorageClientMock) GetObjectCalls() []struct{ ... }
- func (mock *CloudStorageClientMock) PutObject(ctx context.Context, bucketName string, objectName string) (io.WriteCloser, error)
- func (mock *CloudStorageClientMock) PutObjectCalls() []struct{ ... }
- type NotifyServiceMock
- type PolicyClientMock
- type PubSubClientMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BigQueryClientMock ¶
type BigQueryClientMock struct { // QueryFunc mocks the Query method. QueryFunc func(ctx context.Context, query string) (interfaces.BigQueryIterator, error) // contains filtered or unexported fields }
BigQueryClientMock is a mock implementation of interfaces.BigQueryClient.
func TestSomethingThatUsesBigQueryClient(t *testing.T) { // make and configure a mocked interfaces.BigQueryClient mockedBigQueryClient := &BigQueryClientMock{ QueryFunc: func(ctx context.Context, query string) (interfaces.BigQueryIterator, error) { panic("mock out the Query method") }, } // use mockedBigQueryClient in code that requires interfaces.BigQueryClient // and then make assertions. }
func (*BigQueryClientMock) Query ¶
func (mock *BigQueryClientMock) Query(ctx context.Context, query string) (interfaces.BigQueryIterator, error)
Query calls QueryFunc.
func (*BigQueryClientMock) QueryCalls ¶
func (mock *BigQueryClientMock) QueryCalls() []struct { Ctx context.Context Query string }
QueryCalls gets all the calls that were made to Query. Check the length with:
len(mockedBigQueryClient.QueryCalls())
type CacheServiceMock ¶
type CacheServiceMock struct { // NewReaderFunc mocks the NewReader method. NewReaderFunc func(ctx context.Context, ID model.QueryID) (io.ReadCloser, error) // NewWriterFunc mocks the NewWriter method. NewWriterFunc func(ctx context.Context, ID model.QueryID) (io.WriteCloser, error) // StringFunc mocks the String method. StringFunc func() string // contains filtered or unexported fields }
CacheServiceMock is a mock implementation of interfaces.CacheService.
func TestSomethingThatUsesCacheService(t *testing.T) { // make and configure a mocked interfaces.CacheService mockedCacheService := &CacheServiceMock{ NewReaderFunc: func(ctx context.Context, ID model.QueryID) (io.ReadCloser, error) { panic("mock out the NewReader method") }, NewWriterFunc: func(ctx context.Context, ID model.QueryID) (io.WriteCloser, error) { panic("mock out the NewWriter method") }, StringFunc: func() string { panic("mock out the String method") }, } // use mockedCacheService in code that requires interfaces.CacheService // and then make assertions. }
func (*CacheServiceMock) NewReader ¶
func (mock *CacheServiceMock) NewReader(ctx context.Context, ID model.QueryID) (io.ReadCloser, error)
NewReader calls NewReaderFunc.
func (*CacheServiceMock) NewReaderCalls ¶
func (mock *CacheServiceMock) NewReaderCalls() []struct { Ctx context.Context ID model.QueryID }
NewReaderCalls gets all the calls that were made to NewReader. Check the length with:
len(mockedCacheService.NewReaderCalls())
func (*CacheServiceMock) NewWriter ¶
func (mock *CacheServiceMock) NewWriter(ctx context.Context, ID model.QueryID) (io.WriteCloser, error)
NewWriter calls NewWriterFunc.
func (*CacheServiceMock) NewWriterCalls ¶
func (mock *CacheServiceMock) NewWriterCalls() []struct { Ctx context.Context ID model.QueryID }
NewWriterCalls gets all the calls that were made to NewWriter. Check the length with:
len(mockedCacheService.NewWriterCalls())
func (*CacheServiceMock) String ¶
func (mock *CacheServiceMock) String() string
String calls StringFunc.
func (*CacheServiceMock) StringCalls ¶
func (mock *CacheServiceMock) StringCalls() []struct { }
StringCalls gets all the calls that were made to String. Check the length with:
len(mockedCacheService.StringCalls())
type CloudStorageClientMock ¶
type CloudStorageClientMock struct { // GetObjectFunc mocks the GetObject method. GetObjectFunc func(ctx context.Context, bucketName string, objectName string) (io.ReadCloser, error) // PutObjectFunc mocks the PutObject method. PutObjectFunc func(ctx context.Context, bucketName string, objectName string) (io.WriteCloser, error) // contains filtered or unexported fields }
CloudStorageClientMock is a mock implementation of interfaces.CloudStorageClient.
func TestSomethingThatUsesCloudStorageClient(t *testing.T) { // make and configure a mocked interfaces.CloudStorageClient mockedCloudStorageClient := &CloudStorageClientMock{ GetObjectFunc: func(ctx context.Context, bucketName string, objectName string) (io.ReadCloser, error) { panic("mock out the GetObject method") }, PutObjectFunc: func(ctx context.Context, bucketName string, objectName string) (io.WriteCloser, error) { panic("mock out the PutObject method") }, } // use mockedCloudStorageClient in code that requires interfaces.CloudStorageClient // and then make assertions. }
func (*CloudStorageClientMock) GetObject ¶
func (mock *CloudStorageClientMock) GetObject(ctx context.Context, bucketName string, objectName string) (io.ReadCloser, error)
GetObject calls GetObjectFunc.
func (*CloudStorageClientMock) GetObjectCalls ¶
func (mock *CloudStorageClientMock) GetObjectCalls() []struct { Ctx context.Context BucketName string ObjectName string }
GetObjectCalls gets all the calls that were made to GetObject. Check the length with:
len(mockedCloudStorageClient.GetObjectCalls())
func (*CloudStorageClientMock) PutObject ¶
func (mock *CloudStorageClientMock) PutObject(ctx context.Context, bucketName string, objectName string) (io.WriteCloser, error)
PutObject calls PutObjectFunc.
func (*CloudStorageClientMock) PutObjectCalls ¶
func (mock *CloudStorageClientMock) PutObjectCalls() []struct { Ctx context.Context BucketName string ObjectName string }
PutObjectCalls gets all the calls that were made to PutObject. Check the length with:
len(mockedCloudStorageClient.PutObjectCalls())
type NotifyServiceMock ¶
type NotifyServiceMock struct { // PublishFunc mocks the Publish method. PublishFunc func(ctx context.Context, alert model.Alert) error // contains filtered or unexported fields }
NotifyServiceMock is a mock implementation of interfaces.NotifyService.
func TestSomethingThatUsesNotifyService(t *testing.T) { // make and configure a mocked interfaces.NotifyService mockedNotifyService := &NotifyServiceMock{ PublishFunc: func(ctx context.Context, alert model.Alert) error { panic("mock out the Publish method") }, } // use mockedNotifyService in code that requires interfaces.NotifyService // and then make assertions. }
func (*NotifyServiceMock) PublishCalls ¶
func (mock *NotifyServiceMock) PublishCalls() []struct { Ctx context.Context Alert model.Alert }
PublishCalls gets all the calls that were made to Publish. Check the length with:
len(mockedNotifyService.PublishCalls())
type PolicyClientMock ¶
type PolicyClientMock struct { // MetadataFunc mocks the Metadata method. MetadataFunc func() ast.FlatAnnotationsRefSet // QueryFunc mocks the Query method. QueryFunc func(ctx context.Context, query string, input any, output any, options ...opac.QueryOption) error // contains filtered or unexported fields }
PolicyClientMock is a mock implementation of interfaces.PolicyClient.
func TestSomethingThatUsesPolicyClient(t *testing.T) { // make and configure a mocked interfaces.PolicyClient mockedPolicyClient := &PolicyClientMock{ MetadataFunc: func() ast.FlatAnnotationsRefSet { panic("mock out the Metadata method") }, QueryFunc: func(ctx context.Context, query string, input any, output any, options ...opac.QueryOption) error { panic("mock out the Query method") }, } // use mockedPolicyClient in code that requires interfaces.PolicyClient // and then make assertions. }
func (*PolicyClientMock) Metadata ¶
func (mock *PolicyClientMock) Metadata() ast.FlatAnnotationsRefSet
Metadata calls MetadataFunc.
func (*PolicyClientMock) MetadataCalls ¶
func (mock *PolicyClientMock) MetadataCalls() []struct { }
MetadataCalls gets all the calls that were made to Metadata. Check the length with:
len(mockedPolicyClient.MetadataCalls())
func (*PolicyClientMock) Query ¶
func (mock *PolicyClientMock) Query(ctx context.Context, query string, input any, output any, options ...opac.QueryOption) error
Query calls QueryFunc.
func (*PolicyClientMock) QueryCalls ¶
func (mock *PolicyClientMock) QueryCalls() []struct { Ctx context.Context Query string Input any Output any Options []opac.QueryOption }
QueryCalls gets all the calls that were made to Query. Check the length with:
len(mockedPolicyClient.QueryCalls())
type PubSubClientMock ¶
type PubSubClientMock struct { // PublishFunc mocks the Publish method. PublishFunc func(ctx context.Context, topic string, data []byte) error // contains filtered or unexported fields }
PubSubClientMock is a mock implementation of interfaces.PubSubClient.
func TestSomethingThatUsesPubSubClient(t *testing.T) { // make and configure a mocked interfaces.PubSubClient mockedPubSubClient := &PubSubClientMock{ PublishFunc: func(ctx context.Context, topic string, data []byte) error { panic("mock out the Publish method") }, } // use mockedPubSubClient in code that requires interfaces.PubSubClient // and then make assertions. }
func (*PubSubClientMock) PublishCalls ¶
func (mock *PubSubClientMock) PublishCalls() []struct { Ctx context.Context Topic string Data []byte }
PublishCalls gets all the calls that were made to Publish. Check the length with:
len(mockedPubSubClient.PublishCalls())