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: 7 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 {
	// 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 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")
		},
		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 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) 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 GeneratorMock

type GeneratorMock struct {
	// NewPSKFunc mocks the NewPSK method.
	NewPSKFunc func() ([]byte, error)
	// 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")
		},
	}

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

}

func (*GeneratorMock) NewPSK

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

NewPSK calls NewPSKFunc.

func (*GeneratorMock) NewPSKCalls

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

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

len(mockedGenerator.NewPSKCalls())

type S3ClientMock

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

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

	// 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 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")
		},
		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")
		},
		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 handler.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) 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) 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 {
	// 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 handler.VaultClient.

func TestSomethingThatUsesVaultClient(t *testing.T) {

	// make and configure a mocked handler.VaultClient
	mockedVaultClient := &VaultClientMock{
		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 handler.VaultClient
	// and then make assertions.

}

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