mock

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 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 CantabularClientMock

type CantabularClientMock struct {
	// 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
}

CantabularClientMock is a mock implementation of handler.CantabularClient.

func TestSomethingThatUsesCantabularClient(t *testing.T) {

	// make and configure a mocked handler.CantabularClient
	mockedCantabularClient := &CantabularClientMock{
		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 handler.CantabularClient
	// and then make assertions.

}

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

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

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

DatasetAPIClientMock is a mock implementation of handler.DatasetAPIClient.

func TestSomethingThatUsesDatasetAPIClient(t *testing.T) {

	// make and configure a mocked handler.DatasetAPIClient
	mockedDatasetAPIClient := &DatasetAPIClientMock{
		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")
		},
		PutVersionFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, datasetID string, edition string, version string, v dataset.Version) error {
			panic("mock out the PutVersion method")
		},
	}

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

}

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) PutVersion added in v0.7.0

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

PutVersion calls PutVersionFunc.

func (*DatasetAPIClientMock) PutVersionCalls added in v0.7.0

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

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

len(mockedDatasetAPIClient.PutVersionCalls())

type FilterAPIClientMock added in v1.0.0

type FilterAPIClientMock struct {
	// GetDimensionsFunc mocks the GetDimensions method.
	GetDimensionsFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, filterID string, q *filter.QueryParams) (filter.Dimensions, string, error)

	// GetOutputFunc mocks the GetOutput method.
	GetOutputFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceToken string, collectionID string, filterOutput string) (filter.Model, error)

	// UpdateFilterOutputFunc mocks the UpdateFilterOutput method.
	UpdateFilterOutputFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceToken string, filterOutputID string, m *filter.Model) error
	// contains filtered or unexported fields
}

FilterAPIClientMock is a mock implementation of handler.FilterAPIClient.

func TestSomethingThatUsesFilterAPIClient(t *testing.T) {

	// make and configure a mocked handler.FilterAPIClient
	mockedFilterAPIClient := &FilterAPIClientMock{
		GetDimensionsFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, filterID string, q *filter.QueryParams) (filter.Dimensions, string, error) {
			panic("mock out the GetDimensions method")
		},
		GetOutputFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceToken string, collectionID string, filterOutput string) (filter.Model, error) {
			panic("mock out the GetOutput method")
		},
		UpdateFilterOutputFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceToken string, filterOutputID string, m *filter.Model) error {
			panic("mock out the UpdateFilterOutput method")
		},
	}

	// use mockedFilterAPIClient in code that requires handler.FilterAPIClient
	// and then make assertions.

}

func (*FilterAPIClientMock) GetDimensions added in v1.0.0

func (mock *FilterAPIClientMock) GetDimensions(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, filterID string, q *filter.QueryParams) (filter.Dimensions, string, error)

GetDimensions calls GetDimensionsFunc.

func (*FilterAPIClientMock) GetDimensionsCalls added in v1.0.0

func (mock *FilterAPIClientMock) GetDimensionsCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	FilterID         string
	Q                *filter.QueryParams
}

GetDimensionsCalls gets all the calls that were made to GetDimensions. Check the length with:

len(mockedFilterAPIClient.GetDimensionsCalls())

func (*FilterAPIClientMock) GetOutput added in v1.0.0

func (mock *FilterAPIClientMock) GetOutput(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceToken string, collectionID string, filterOutput string) (filter.Model, error)

GetOutput calls GetOutputFunc.

func (*FilterAPIClientMock) GetOutputCalls added in v1.0.0

func (mock *FilterAPIClientMock) GetOutputCalls() []struct {
	Ctx                  context.Context
	UserAuthToken        string
	ServiceAuthToken     string
	DownloadServiceToken string
	CollectionID         string
	FilterOutput         string
}

GetOutputCalls gets all the calls that were made to GetOutput. Check the length with:

len(mockedFilterAPIClient.GetOutputCalls())

func (*FilterAPIClientMock) UpdateFilterOutput added in v1.0.0

func (mock *FilterAPIClientMock) UpdateFilterOutput(ctx context.Context, userAuthToken string, serviceAuthToken string, downloadServiceToken string, filterOutputID string, m *filter.Model) error

UpdateFilterOutput calls UpdateFilterOutputFunc.

func (*FilterAPIClientMock) UpdateFilterOutputCalls added in v1.0.0

func (mock *FilterAPIClientMock) UpdateFilterOutputCalls() []struct {
	Ctx                  context.Context
	UserAuthToken        string
	ServiceAuthToken     string
	DownloadServiceToken string
	FilterOutputID       string
	M                    *filter.Model
}

UpdateFilterOutputCalls gets all the calls that were made to UpdateFilterOutput. Check the length with:

len(mockedFilterAPIClient.UpdateFilterOutputCalls())

type GeneratorMock added in v0.4.0

type GeneratorMock struct {
	// NewPSKFunc mocks the NewPSK method.
	NewPSKFunc func() ([]byte, error)

	// TimestampFunc mocks the Timestamp method.
	TimestampFunc func() time.Time
	// contains filtered or unexported fields
}

GeneratorMock is a mock implementation of handler.Generator.

func TestSomethingThatUsesGenerator(t *testing.T) {

	// make and configure a mocked handler.Generator
	mockedGenerator := &GeneratorMock{
		NewPSKFunc: func() ([]byte, error) {
			panic("mock out the NewPSK method")
		},
		TimestampFunc: func() time.Time {
			panic("mock out the Timestamp method")
		},
	}

	// use mockedGenerator in code that requires handler.Generator
	// and then make assertions.

}

func (*GeneratorMock) NewPSK added in v0.4.0

func (mock *GeneratorMock) NewPSK() ([]byte, error)

NewPSK calls NewPSKFunc.

func (*GeneratorMock) NewPSKCalls added in v0.4.0

func (mock *GeneratorMock) NewPSKCalls() []struct {
}

NewPSKCalls gets all the calls that were made to NewPSK. Check the length with:

len(mockedGenerator.NewPSKCalls())

func (*GeneratorMock) Timestamp added in v1.0.0

func (mock *GeneratorMock) Timestamp() time.Time

Timestamp calls TimestampFunc.

func (*GeneratorMock) TimestampCalls added in v1.0.0

func (mock *GeneratorMock) TimestampCalls() []struct {
}

TimestampCalls gets all the calls that were made to Timestamp. Check the length with:

len(mockedGenerator.TimestampCalls())

type S3ClientMock

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

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

	// 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
}

S3ClientMock is a mock implementation of handler.S3Client.

func TestSomethingThatUsesS3Client(t *testing.T) {

	// make and configure a mocked handler.S3Client
	mockedS3Client := &S3ClientMock{
		BucketNameFunc: func() string {
			panic("mock out the BucketName method")
		},
		HeadFunc: func(key string) (*s3.HeadObjectOutput, error) {
			panic("mock out the Head 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 mockedS3Client in code that requires handler.S3Client
	// and then make assertions.

}

func (*S3ClientMock) BucketName added in v0.8.0

func (mock *S3ClientMock) BucketName() string

BucketName calls BucketNameFunc.

func (*S3ClientMock) BucketNameCalls added in v0.8.0

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

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

len(mockedS3Client.BucketNameCalls())

func (*S3ClientMock) Head added in v0.8.0

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

Head calls HeadFunc.

func (*S3ClientMock) HeadCalls added in v0.8.0

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) UploadWithContext added in v0.8.0

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

UploadWithContext calls UploadWithContextFunc.

func (*S3ClientMock) UploadWithContextCalls added in v0.8.0

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) UploadWithPSK added in v0.8.0

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

UploadWithPSK calls UploadWithPSKFunc.

func (*S3ClientMock) UploadWithPSKCalls added in v0.8.0

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

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

len(mockedS3Client.UploadWithPSKCalls())

type VaultClientMock added in v0.3.0

type VaultClientMock struct {
	// 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 handler.VaultClient.

func TestSomethingThatUsesVaultClient(t *testing.T) {

	// make and configure a mocked handler.VaultClient
	mockedVaultClient := &VaultClientMock{
		WriteKeyFunc: func(path string, key string, value string) error {
			panic("mock out the WriteKey method")
		},
	}

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

}

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