mock

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatasetAPIClientMock

type DatasetAPIClientMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(contextMoqParam context.Context, checkState *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)

	// GetVersionMetadataFunc mocks the GetVersionMetadata method.
	GetVersionMetadataFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, id string, edition string, version string) (dataset.Metadata, error)

	// GetVersionMetadataSelectionFunc mocks the GetVersionMetadataSelection method.
	GetVersionMetadataSelectionFunc func(contextMoqParam context.Context, getVersionMetadataSelectionInput dataset.GetVersionMetadataSelectionInput) (*dataset.Metadata, error)

	// PutVersionFunc mocks the PutVersion method.
	PutVersionFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string, edition string, version string, m dataset.Version) error
	// contains filtered or unexported fields
}

DatasetAPIClientMock is a mock implementation of service.DatasetAPIClient.

func TestSomethingThatUsesDatasetAPIClient(t *testing.T) {

	// make and configure a mocked service.DatasetAPIClient
	mockedDatasetAPIClient := &DatasetAPIClientMock{
		CheckerFunc: func(contextMoqParam context.Context, checkState *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")
		},
		GetVersionMetadataFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, id string, edition string, version string) (dataset.Metadata, error) {
			panic("mock out the GetVersionMetadata method")
		},
		GetVersionMetadataSelectionFunc: func(contextMoqParam context.Context, getVersionMetadataSelectionInput dataset.GetVersionMetadataSelectionInput) (*dataset.Metadata, error) {
			panic("mock out the GetVersionMetadataSelection method")
		},
		PutVersionFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string, edition string, version string, m dataset.Version) error {
			panic("mock out the PutVersion method")
		},
	}

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

}

func (*DatasetAPIClientMock) Checker

func (mock *DatasetAPIClientMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*DatasetAPIClientMock) CheckerCalls

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

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

len(mockedDatasetAPIClient.CheckerCalls())

func (*DatasetAPIClientMock) GetInstance

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

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) GetVersionMetadata

func (mock *DatasetAPIClientMock) GetVersionMetadata(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, id string, edition string, version string) (dataset.Metadata, error)

GetVersionMetadata calls GetVersionMetadataFunc.

func (*DatasetAPIClientMock) GetVersionMetadataCalls

func (mock *DatasetAPIClientMock) GetVersionMetadataCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	ID               string
	Edition          string
	Version          string
}

GetVersionMetadataCalls gets all the calls that were made to GetVersionMetadata. Check the length with:

len(mockedDatasetAPIClient.GetVersionMetadataCalls())

func (*DatasetAPIClientMock) GetVersionMetadataSelection added in v1.0.0

func (mock *DatasetAPIClientMock) GetVersionMetadataSelection(contextMoqParam context.Context, getVersionMetadataSelectionInput dataset.GetVersionMetadataSelectionInput) (*dataset.Metadata, error)

GetVersionMetadataSelection calls GetVersionMetadataSelectionFunc.

func (*DatasetAPIClientMock) GetVersionMetadataSelectionCalls added in v1.0.0

func (mock *DatasetAPIClientMock) GetVersionMetadataSelectionCalls() []struct {
	ContextMoqParam                  context.Context
	GetVersionMetadataSelectionInput dataset.GetVersionMetadataSelectionInput
}

GetVersionMetadataSelectionCalls gets all the calls that were made to GetVersionMetadataSelection. Check the length with:

len(mockedDatasetAPIClient.GetVersionMetadataSelectionCalls())

func (*DatasetAPIClientMock) PutVersion

func (mock *DatasetAPIClientMock) PutVersion(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string, edition string, version string, m dataset.Version) error

PutVersion calls PutVersionFunc.

func (*DatasetAPIClientMock) PutVersionCalls

func (mock *DatasetAPIClientMock) PutVersionCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	DatasetID        string
	Edition          string
	Version          string
	M                dataset.Version
}

PutVersionCalls gets all the calls that were made to PutVersion. Check the length with:

len(mockedDatasetAPIClient.PutVersionCalls())

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 {
	// AddCheckFunc mocks the AddCheck method.
	AddCheckFunc func(name string, checker healthcheck.Checker) 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()

	// SubscribeAllFunc mocks the SubscribeAll method.
	SubscribeAllFunc func(s healthcheck.Subscriber)
	// 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{
		AddCheckFunc: func(name string, checker healthcheck.Checker) error {
			panic("mock out the AddCheck 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")
		},
		SubscribeAllFunc: func(s healthcheck.Subscriber)  {
			panic("mock out the SubscribeAll method")
		},
	}

	// use mockedHealthChecker in code that requires service.HealthChecker
	// and then make assertions.

}

func (*HealthCheckerMock) AddCheck

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

AddCheck calls AddCheckFunc.

func (*HealthCheckerMock) AddCheckCalls

func (mock *HealthCheckerMock) AddCheckCalls() []struct {
	Name    string
	Checker healthcheck.Checker
}

AddCheckCalls gets all the calls that were made to AddCheck. Check the length with:

len(mockedHealthChecker.AddCheckCalls())

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) SubscribeAll

func (mock *HealthCheckerMock) SubscribeAll(s healthcheck.Subscriber)

SubscribeAll calls SubscribeAllFunc.

func (*HealthCheckerMock) SubscribeAllCalls

func (mock *HealthCheckerMock) SubscribeAllCalls() []struct {
	S healthcheck.Subscriber
}

SubscribeAllCalls gets all the calls that were made to SubscribeAll. Check the length with:

len(mockedHealthChecker.SubscribeAllCalls())

type S3ClientMock

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

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

	// GetFunc mocks the Get method.
	GetFunc func(key string) (io.ReadCloser, *int64, error)

	// GetWithPSKFunc mocks the GetWithPSK method.
	GetWithPSKFunc func(key string, psk []byte) (io.ReadCloser, *int64, 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)

	// UploadWithPSKAndContextFunc mocks the UploadWithPSKAndContext method.
	UploadWithPSKAndContextFunc func(ctx context.Context, input *s3manager.UploadInput, psk []byte, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)
	// contains filtered or unexported fields
}

S3ClientMock is a mock implementation of service.S3Client.

func TestSomethingThatUsesS3Client(t *testing.T) {

	// make and configure a mocked service.S3Client
	mockedS3Client := &S3ClientMock{
		BucketNameFunc: func() string {
			panic("mock out the BucketName method")
		},
		CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		GetFunc: func(key string) (io.ReadCloser, *int64, error) {
			panic("mock out the Get method")
		},
		GetWithPSKFunc: func(key string, psk []byte) (io.ReadCloser, *int64, error) {
			panic("mock out the GetWithPSK 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")
		},
		UploadWithPSKAndContextFunc: func(ctx context.Context, input *s3manager.UploadInput, psk []byte, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error) {
			panic("mock out the UploadWithPSKAndContext method")
		},
	}

	// use mockedS3Client in code that requires service.S3Client
	// and then make assertions.

}

func (*S3ClientMock) BucketName

func (mock *S3ClientMock) BucketName() string

BucketName calls BucketNameFunc.

func (*S3ClientMock) BucketNameCalls

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

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

len(mockedS3Client.BucketNameCalls())

func (*S3ClientMock) Checker

func (mock *S3ClientMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*S3ClientMock) CheckerCalls

func (mock *S3ClientMock) CheckerCalls() []struct {
	ContextMoqParam context.Context
	CheckState      *healthcheck.CheckState
}

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

len(mockedS3Client.CheckerCalls())

func (*S3ClientMock) Get

func (mock *S3ClientMock) Get(key string) (io.ReadCloser, *int64, error)

Get calls GetFunc.

func (*S3ClientMock) GetCalls

func (mock *S3ClientMock) GetCalls() []struct {
	Key string
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedS3Client.GetCalls())

func (*S3ClientMock) GetWithPSK

func (mock *S3ClientMock) GetWithPSK(key string, psk []byte) (io.ReadCloser, *int64, error)

GetWithPSK calls GetWithPSKFunc.

func (*S3ClientMock) GetWithPSKCalls

func (mock *S3ClientMock) GetWithPSKCalls() []struct {
	Key string
	Psk []byte
}

GetWithPSKCalls gets all the calls that were made to GetWithPSK. Check the length with:

len(mockedS3Client.GetWithPSKCalls())

func (*S3ClientMock) Head

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

Head calls HeadFunc.

func (*S3ClientMock) HeadCalls

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

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

len(mockedS3Client.HeadCalls())

func (*S3ClientMock) Session

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

Session calls SessionFunc.

func (*S3ClientMock) SessionCalls

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

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

len(mockedS3Client.SessionCalls())

func (*S3ClientMock) UploadWithContext

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

UploadWithContext calls UploadWithContextFunc.

func (*S3ClientMock) UploadWithContextCalls

func (mock *S3ClientMock) 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(mockedS3Client.UploadWithContextCalls())

func (*S3ClientMock) UploadWithPSKAndContext

func (mock *S3ClientMock) UploadWithPSKAndContext(ctx context.Context, input *s3manager.UploadInput, psk []byte, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)

UploadWithPSKAndContext calls UploadWithPSKAndContextFunc.

func (*S3ClientMock) UploadWithPSKAndContextCalls

func (mock *S3ClientMock) UploadWithPSKAndContextCalls() []struct {
	Ctx     context.Context
	Input   *s3manager.UploadInput
	Psk     []byte
	Options []func(*s3manager.Uploader)
}

UploadWithPSKAndContextCalls gets all the calls that were made to UploadWithPSKAndContext. Check the length with:

len(mockedS3Client.UploadWithPSKAndContextCalls())

type VaultClientMock

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

	// ReadKeyFunc mocks the ReadKey method.
	ReadKeyFunc func(path string, key string) (string, error)

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

VaultClientMock is a mock implementation of service.VaultClient.

func TestSomethingThatUsesVaultClient(t *testing.T) {

	// make and configure a mocked service.VaultClient
	mockedVaultClient := &VaultClientMock{
		CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		ReadKeyFunc: func(path string, key string) (string, error) {
			panic("mock out the ReadKey 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

func (mock *VaultClientMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*VaultClientMock) CheckerCalls

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

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

len(mockedVaultClient.CheckerCalls())

func (*VaultClientMock) ReadKey

func (mock *VaultClientMock) ReadKey(path string, key string) (string, error)

ReadKey calls ReadKeyFunc.

func (*VaultClientMock) ReadKeyCalls

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

ReadKeyCalls gets all the calls that were made to ReadKey. Check the length with:

len(mockedVaultClient.ReadKeyCalls())

func (*VaultClientMock) WriteKey

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

WriteKey calls WriteKeyFunc.

func (*VaultClientMock) WriteKeyCalls

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