mock

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CantabularClientMock added in v0.2.0

type CantabularClientMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(in1 context.Context, in2 *healthcheck.CheckState) error

	// CheckerAPIExtFunc mocks the CheckerAPIExt method.
	CheckerAPIExtFunc func(ctx context.Context, state *healthcheck.CheckState) error

	// StaticDatasetQueryStreamCSVFunc mocks the StaticDatasetQueryStreamCSV method.
	StaticDatasetQueryStreamCSVFunc func(ctx context.Context, req cantabular.StaticDatasetQueryRequest, consume func(ctx context.Context, r io.Reader) error) (int32, error)
	// contains filtered or unexported fields
}

Example of how to instantiate a mock for testing - this code is automatically generated CantabularClientMock is a mock implementation of service.CantabularClient.

    func TestSomethingThatUsesCantabularClient(t *testing.T) {

        // make and configure a mocked service.CantabularClient
        mockedCantabularClient := &CantabularClientMock{
            CheckerFunc: func(in1 context.Context, in2 *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            CheckerAPIExtFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
	               panic("mock out the CheckerAPIExt method")
            },
            StaticDatasetQueryStreamCSVFunc: func(ctx context.Context, req cantabular.StaticDatasetQueryRequest, consume func(ctx context.Context, r io.Reader) error) (int32, error) {
	               panic("mock out the StaticDatasetQueryStreamCSV method")
            },
        }

        // use mockedCantabularClient in code that requires service.CantabularClient
        // and then make assertions.

    }

func (*CantabularClientMock) Checker added in v0.2.0

Checker calls CheckerFunc.

func (*CantabularClientMock) CheckerAPIExt added in v0.6.0

func (mock *CantabularClientMock) CheckerAPIExt(ctx context.Context, state *healthcheck.CheckState) error

CheckerAPIExt calls CheckerAPIExtFunc.

func (*CantabularClientMock) CheckerAPIExtCalls added in v0.6.0

func (mock *CantabularClientMock) CheckerAPIExtCalls() []struct {
	Ctx   context.Context
	State *healthcheck.CheckState
}

CheckerAPIExtCalls gets all the calls that were made to CheckerAPIExt. Check the length with:

len(mockedCantabularClient.CheckerAPIExtCalls())

func (*CantabularClientMock) CheckerCalls added in v0.2.0

func (mock *CantabularClientMock) CheckerCalls() []struct {
	In1 context.Context
	In2 *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedCantabularClient.CheckerCalls())

func (*CantabularClientMock) StaticDatasetQueryStreamCSV added in v0.6.0

func (mock *CantabularClientMock) StaticDatasetQueryStreamCSV(ctx context.Context, req cantabular.StaticDatasetQueryRequest, consume func(ctx context.Context, r io.Reader) error) (int32, error)

StaticDatasetQueryStreamCSV calls StaticDatasetQueryStreamCSVFunc.

func (*CantabularClientMock) StaticDatasetQueryStreamCSVCalls added in v0.6.0

func (mock *CantabularClientMock) StaticDatasetQueryStreamCSVCalls() []struct {
	Ctx     context.Context
	Req     cantabular.StaticDatasetQueryRequest
	Consume func(ctx context.Context, r io.Reader) error
}

StaticDatasetQueryStreamCSVCalls gets all the calls that were made to StaticDatasetQueryStreamCSV. Check the length with:

len(mockedCantabularClient.StaticDatasetQueryStreamCSVCalls())

type DatasetAPIClientMock added in v0.2.0

type DatasetAPIClientMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(in1 context.Context, in2 *healthcheck.CheckState) error

	// GetInstanceFunc mocks the GetInstance method.
	GetInstanceFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, ifMatch string) (dataset.Instance, string, error)

	// PutInstanceFunc mocks the PutInstance method.
	PutInstanceFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, instanceUpdate dataset.UpdateInstance, ifMatch string) (string, error)
	// contains filtered or unexported fields
}

Example of how to instantiate a mock for testing - this code is automatically generated DatasetAPIClientMock is a mock implementation of service.DatasetAPIClient.

    func TestSomethingThatUsesDatasetAPIClient(t *testing.T) {

        // make and configure a mocked service.DatasetAPIClient
        mockedDatasetAPIClient := &DatasetAPIClientMock{
            CheckerFunc: func(in1 context.Context, in2 *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            GetInstanceFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, ifMatch string) (dataset.Instance, string, error) {
	               panic("mock out the GetInstance method")
            },
            PutInstanceFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, instanceUpdate dataset.UpdateInstance, ifMatch string) (string, error) {
	               panic("mock out the PutInstance method")
            },
        }

        // use mockedDatasetAPIClient in code that requires service.DatasetAPIClient
        // and then make assertions.

    }

func (*DatasetAPIClientMock) Checker added in v0.2.0

Checker calls CheckerFunc.

func (*DatasetAPIClientMock) CheckerCalls added in v0.2.0

func (mock *DatasetAPIClientMock) CheckerCalls() []struct {
	In1 context.Context
	In2 *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedDatasetAPIClient.CheckerCalls())

func (*DatasetAPIClientMock) GetInstance added in v0.2.0

func (mock *DatasetAPIClientMock) GetInstance(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, ifMatch string) (dataset.Instance, string, error)

GetInstance calls GetInstanceFunc.

func (*DatasetAPIClientMock) GetInstanceCalls added in v0.2.0

func (mock *DatasetAPIClientMock) GetInstanceCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	InstanceID       string
	IfMatch          string
}

GetInstanceCalls gets all the calls that were made to GetInstance. Check the length with:

len(mockedDatasetAPIClient.GetInstanceCalls())

func (*DatasetAPIClientMock) PutInstance added in v0.3.0

func (mock *DatasetAPIClientMock) PutInstance(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, instanceUpdate dataset.UpdateInstance, ifMatch string) (string, error)

PutInstance calls PutInstanceFunc.

func (*DatasetAPIClientMock) PutInstanceCalls added in v0.3.0

func (mock *DatasetAPIClientMock) PutInstanceCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	InstanceID       string
	InstanceUpdate   dataset.UpdateInstance
	IfMatch          string
}

PutInstanceCalls gets all the calls that were made to PutInstance. Check the length with:

len(mockedDatasetAPIClient.PutInstanceCalls())

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
}

Example of how to instantiate a mock for testing - this code is automatically generated 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(w http.ResponseWriter, req *http.Request)

	// StartFunc mocks the Start method.
	StartFunc func(ctx context.Context)

	// StopFunc mocks the Stop method.
	StopFunc func()

	// SubscribeFunc mocks the Subscribe method.
	SubscribeFunc func(s healthcheck.Subscriber, checks ...*healthcheck.Check)
	// contains filtered or unexported fields
}

Example of how to instantiate a mock for testing - this code is automatically generated 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(w http.ResponseWriter, req *http.Request)  {
	               panic("mock out the Handler method")
            },
            StartFunc: func(ctx context.Context)  {
	               panic("mock out the Start method")
            },
            StopFunc: func()  {
	               panic("mock out the Stop method")
            },
            SubscribeFunc: func(s 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 added in v0.6.0

func (mock *HealthCheckerMock) AddAndGetCheck(name string, checker healthcheck.Checker) (*healthcheck.Check, error)

AddAndGetCheck calls AddAndGetCheckFunc.

func (*HealthCheckerMock) AddAndGetCheckCalls added in v0.6.0

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(w http.ResponseWriter, req *http.Request)

Handler calls HandlerFunc.

func (*HealthCheckerMock) HandlerCalls

func (mock *HealthCheckerMock) HandlerCalls() []struct {
	W   http.ResponseWriter
	Req *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(ctx context.Context)

Start calls StartFunc.

func (*HealthCheckerMock) StartCalls

func (mock *HealthCheckerMock) StartCalls() []struct {
	Ctx context.Context
}

StartCalls gets all the calls that were made to Start. Check the length with:

len(mockedHealthChecker.StartCalls())

func (*HealthCheckerMock) Stop

func (mock *HealthCheckerMock) Stop()

Stop calls StopFunc.

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 added in v0.6.0

func (mock *HealthCheckerMock) Subscribe(s healthcheck.Subscriber, checks ...*healthcheck.Check)

Subscribe calls SubscribeFunc.

func (*HealthCheckerMock) SubscribeCalls added in v0.6.0

func (mock *HealthCheckerMock) SubscribeCalls() []struct {
	S      healthcheck.Subscriber
	Checks []*healthcheck.Check
}

SubscribeCalls gets all the calls that were made to Subscribe. Check the length with:

len(mockedHealthChecker.SubscribeCalls())

type S3UploaderMock added in v0.3.0

type S3UploaderMock struct {
	// BucketNameFunc mocks the BucketName method.
	BucketNameFunc func() string

	// CheckerFunc mocks the Checker method.
	CheckerFunc func(in1 context.Context, in2 *healthcheck.CheckState) error

	// HeadFunc mocks the Head method.
	HeadFunc func(key string) (*s3.HeadObjectOutput, error)

	// SessionFunc mocks the Session method.
	SessionFunc func() *session.Session

	// UploadWithContextFunc mocks the UploadWithContext method.
	UploadWithContextFunc func(ctx context.Context, input *s3manager.UploadInput, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)

	// UploadWithPSKFunc mocks the UploadWithPSK method.
	UploadWithPSKFunc func(input *s3manager.UploadInput, psk []byte) (*s3manager.UploadOutput, error)
	// contains filtered or unexported fields
}

Example of how to instantiate a mock for testing - this code is automatically generated S3UploaderMock is a mock implementation of service.S3Uploader.

    func TestSomethingThatUsesS3Uploader(t *testing.T) {

        // make and configure a mocked service.S3Uploader
        mockedS3Uploader := &S3UploaderMock{
            BucketNameFunc: func() string {
	               panic("mock out the BucketName method")
            },
            CheckerFunc: func(in1 context.Context, in2 *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            HeadFunc: func(key string) (*s3.HeadObjectOutput, error) {
	               panic("mock out the Head method")
            },
            SessionFunc: func() *session.Session {
	               panic("mock out the Session method")
            },
            UploadWithContextFunc: func(ctx context.Context, input *s3manager.UploadInput, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error) {
	               panic("mock out the UploadWithContext method")
            },
            UploadWithPSKFunc: func(input *s3manager.UploadInput, psk []byte) (*s3manager.UploadOutput, error) {
	               panic("mock out the UploadWithPSK method")
            },
        }

        // use mockedS3Uploader in code that requires service.S3Uploader
        // and then make assertions.

    }

func (*S3UploaderMock) BucketName added in v0.3.0

func (mock *S3UploaderMock) BucketName() string

BucketName calls BucketNameFunc.

func (*S3UploaderMock) BucketNameCalls added in v0.3.0

func (mock *S3UploaderMock) BucketNameCalls() []struct {
}

BucketNameCalls gets all the calls that were made to BucketName. Check the length with:

len(mockedS3Uploader.BucketNameCalls())

func (*S3UploaderMock) Checker added in v0.3.0

func (mock *S3UploaderMock) Checker(in1 context.Context, in2 *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*S3UploaderMock) CheckerCalls added in v0.3.0

func (mock *S3UploaderMock) CheckerCalls() []struct {
	In1 context.Context
	In2 *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedS3Uploader.CheckerCalls())

func (*S3UploaderMock) Head added in v0.6.0

func (mock *S3UploaderMock) Head(key string) (*s3.HeadObjectOutput, error)

Head calls HeadFunc.

func (*S3UploaderMock) HeadCalls added in v0.6.0

func (mock *S3UploaderMock) HeadCalls() []struct {
	Key string
}

HeadCalls gets all the calls that were made to Head. Check the length with:

len(mockedS3Uploader.HeadCalls())

func (*S3UploaderMock) Session added in v0.6.0

func (mock *S3UploaderMock) Session() *session.Session

Session calls SessionFunc.

func (*S3UploaderMock) SessionCalls added in v0.6.0

func (mock *S3UploaderMock) SessionCalls() []struct {
}

SessionCalls gets all the calls that were made to Session. Check the length with:

len(mockedS3Uploader.SessionCalls())

func (*S3UploaderMock) UploadWithContext added in v0.6.0

func (mock *S3UploaderMock) UploadWithContext(ctx context.Context, input *s3manager.UploadInput, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)

UploadWithContext calls UploadWithContextFunc.

func (*S3UploaderMock) UploadWithContextCalls added in v0.6.0

func (mock *S3UploaderMock) UploadWithContextCalls() []struct {
	Ctx     context.Context
	Input   *s3manager.UploadInput
	Options []func(*s3manager.Uploader)
}

UploadWithContextCalls gets all the calls that were made to UploadWithContext. Check the length with:

len(mockedS3Uploader.UploadWithContextCalls())

func (*S3UploaderMock) UploadWithPSK added in v0.3.0

func (mock *S3UploaderMock) UploadWithPSK(input *s3manager.UploadInput, psk []byte) (*s3manager.UploadOutput, error)

UploadWithPSK calls UploadWithPSKFunc.

func (*S3UploaderMock) UploadWithPSKCalls added in v0.3.0

func (mock *S3UploaderMock) UploadWithPSKCalls() []struct {
	Input *s3manager.UploadInput
	Psk   []byte
}

UploadWithPSKCalls gets all the calls that were made to UploadWithPSK. Check the length with:

len(mockedS3Uploader.UploadWithPSKCalls())

type VaultClientMock added in v0.3.0

type VaultClientMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(in1 context.Context, in2 *healthcheck.CheckState) error

	// WriteKeyFunc mocks the WriteKey method.
	WriteKeyFunc func(path string, key string, value string) error
	// contains filtered or unexported fields
}

Example of how to instantiate a mock for testing - this code is automatically generated VaultClientMock is a mock implementation of service.VaultClient.

    func TestSomethingThatUsesVaultClient(t *testing.T) {

        // make and configure a mocked service.VaultClient
        mockedVaultClient := &VaultClientMock{
            CheckerFunc: func(in1 context.Context, in2 *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            WriteKeyFunc: func(path string, key string, value string) error {
	               panic("mock out the WriteKey method")
            },
        }

        // use mockedVaultClient in code that requires service.VaultClient
        // and then make assertions.

    }

func (*VaultClientMock) Checker added in v0.3.0

func (mock *VaultClientMock) Checker(in1 context.Context, in2 *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*VaultClientMock) CheckerCalls added in v0.3.0

func (mock *VaultClientMock) CheckerCalls() []struct {
	In1 context.Context
	In2 *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedVaultClient.CheckerCalls())

func (*VaultClientMock) WriteKey added in v0.3.0

func (mock *VaultClientMock) WriteKey(path string, key string, value string) error

WriteKey calls WriteKeyFunc.

func (*VaultClientMock) WriteKeyCalls added in v0.3.0

func (mock *VaultClientMock) WriteKeyCalls() []struct {
	Path  string
	Key   string
	Value string
}

WriteKeyCalls gets all the calls that were made to WriteKey. Check the length with:

len(mockedVaultClient.WriteKeyCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL