mock

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageAPIClientMock added in v0.7.0

type ImageAPIClientMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error

	// GetDownloadVariantFunc mocks the GetDownloadVariant method.
	GetDownloadVariantFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string, variant string) (image.ImageDownload, error)

	// GetImageFunc mocks the GetImage method.
	GetImageFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string) (image.Image, error)

	// PutDownloadVariantFunc mocks the PutDownloadVariant method.
	PutDownloadVariantFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string, variant string, data image.ImageDownload) (image.ImageDownload, error)

	// PutImageFunc mocks the PutImage method.
	PutImageFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string, data image.Image) (image.Image, error)
	// contains filtered or unexported fields
}

ImageAPIClientMock is a mock implementation of event.ImageAPIClient.

func TestSomethingThatUsesImageAPIClient(t *testing.T) {

	// make and configure a mocked event.ImageAPIClient
	mockedImageAPIClient := &ImageAPIClientMock{
		CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		GetDownloadVariantFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string, variant string) (image.ImageDownload, error) {
			panic("mock out the GetDownloadVariant method")
		},
		GetImageFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string) (image.Image, error) {
			panic("mock out the GetImage method")
		},
		PutDownloadVariantFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string, variant string, data image.ImageDownload) (image.ImageDownload, error) {
			panic("mock out the PutDownloadVariant method")
		},
		PutImageFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string, data image.Image) (image.Image, error) {
			panic("mock out the PutImage method")
		},
	}

	// use mockedImageAPIClient in code that requires event.ImageAPIClient
	// and then make assertions.

}

func (*ImageAPIClientMock) Checker added in v0.7.0

func (mock *ImageAPIClientMock) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*ImageAPIClientMock) CheckerCalls added in v0.7.0

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

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

len(mockedImageAPIClient.CheckerCalls())

func (*ImageAPIClientMock) GetDownloadVariant added in v0.7.0

func (mock *ImageAPIClientMock) GetDownloadVariant(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string, variant string) (image.ImageDownload, error)

GetDownloadVariant calls GetDownloadVariantFunc.

func (*ImageAPIClientMock) GetDownloadVariantCalls added in v0.7.0

func (mock *ImageAPIClientMock) GetDownloadVariantCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	ImageID          string
	Variant          string
}

GetDownloadVariantCalls gets all the calls that were made to GetDownloadVariant. Check the length with:

len(mockedImageAPIClient.GetDownloadVariantCalls())

func (*ImageAPIClientMock) GetImage added in v0.9.0

func (mock *ImageAPIClientMock) GetImage(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string) (image.Image, error)

GetImage calls GetImageFunc.

func (*ImageAPIClientMock) GetImageCalls added in v0.9.0

func (mock *ImageAPIClientMock) GetImageCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	ImageID          string
}

GetImageCalls gets all the calls that were made to GetImage. Check the length with:

len(mockedImageAPIClient.GetImageCalls())

func (*ImageAPIClientMock) PutDownloadVariant added in v0.7.0

func (mock *ImageAPIClientMock) PutDownloadVariant(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string, variant string, data image.ImageDownload) (image.ImageDownload, error)

PutDownloadVariant calls PutDownloadVariantFunc.

func (*ImageAPIClientMock) PutDownloadVariantCalls added in v0.7.0

func (mock *ImageAPIClientMock) PutDownloadVariantCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	ImageID          string
	Variant          string
	Data             image.ImageDownload
}

PutDownloadVariantCalls gets all the calls that were made to PutDownloadVariant. Check the length with:

len(mockedImageAPIClient.PutDownloadVariantCalls())

func (*ImageAPIClientMock) PutImage added in v0.9.0

func (mock *ImageAPIClientMock) PutImage(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string, data image.Image) (image.Image, error)

PutImage calls PutImageFunc.

func (*ImageAPIClientMock) PutImageCalls added in v0.9.0

func (mock *ImageAPIClientMock) PutImageCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	ImageID          string
	Data             image.Image
}

PutImageCalls gets all the calls that were made to PutImage. Check the length with:

len(mockedImageAPIClient.PutImageCalls())

type S3ReaderMock added in v0.7.0

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

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

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

	// SessionFunc mocks the Session method.
	SessionFunc func() *session.Session
	// contains filtered or unexported fields
}

S3ReaderMock is a mock implementation of event.S3Reader.

func TestSomethingThatUsesS3Reader(t *testing.T) {

	// make and configure a mocked event.S3Reader
	mockedS3Reader := &S3ReaderMock{
		BucketNameFunc: func() string {
			panic("mock out the BucketName method")
		},
		CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		GetFunc: func(key string) (io.ReadCloser, *int64, error) {
			panic("mock out the Get method")
		},
		SessionFunc: func() *session.Session {
			panic("mock out the Session method")
		},
	}

	// use mockedS3Reader in code that requires event.S3Reader
	// and then make assertions.

}

func (*S3ReaderMock) BucketName added in v0.7.0

func (mock *S3ReaderMock) BucketName() string

BucketName calls BucketNameFunc.

func (*S3ReaderMock) BucketNameCalls added in v0.7.0

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

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

len(mockedS3Reader.BucketNameCalls())

func (*S3ReaderMock) Checker added in v0.7.0

func (mock *S3ReaderMock) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*S3ReaderMock) CheckerCalls added in v0.7.0

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

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

len(mockedS3Reader.CheckerCalls())

func (*S3ReaderMock) Get added in v0.7.0

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

Get calls GetFunc.

func (*S3ReaderMock) GetCalls added in v0.7.0

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

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

len(mockedS3Reader.GetCalls())

func (*S3ReaderMock) Session added in v0.7.0

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

Session calls SessionFunc.

func (*S3ReaderMock) SessionCalls added in v0.7.0

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

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

len(mockedS3Reader.SessionCalls())

type S3WriterMock added in v0.7.0

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

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

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

	// UploadFunc mocks the Upload method.
	UploadFunc func(input *s3manager.UploadInput, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)
	// contains filtered or unexported fields
}

S3WriterMock is a mock implementation of event.S3Writer.

func TestSomethingThatUsesS3Writer(t *testing.T) {

	// make and configure a mocked event.S3Writer
	mockedS3Writer := &S3WriterMock{
		BucketNameFunc: func() string {
			panic("mock out the BucketName method")
		},
		CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		SessionFunc: func() *session.Session {
			panic("mock out the Session method")
		},
		UploadFunc: func(input *s3manager.UploadInput, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error) {
			panic("mock out the Upload method")
		},
	}

	// use mockedS3Writer in code that requires event.S3Writer
	// and then make assertions.

}

func (*S3WriterMock) BucketName added in v0.7.0

func (mock *S3WriterMock) BucketName() string

BucketName calls BucketNameFunc.

func (*S3WriterMock) BucketNameCalls added in v0.7.0

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

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

len(mockedS3Writer.BucketNameCalls())

func (*S3WriterMock) Checker added in v0.7.0

func (mock *S3WriterMock) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*S3WriterMock) CheckerCalls added in v0.7.0

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

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

len(mockedS3Writer.CheckerCalls())

func (*S3WriterMock) Session added in v0.7.0

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

Session calls SessionFunc.

func (*S3WriterMock) SessionCalls added in v0.7.0

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

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

len(mockedS3Writer.SessionCalls())

func (*S3WriterMock) Upload added in v0.7.0

func (mock *S3WriterMock) Upload(input *s3manager.UploadInput, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error)

Upload calls UploadFunc.

func (*S3WriterMock) UploadCalls added in v0.7.0

func (mock *S3WriterMock) UploadCalls() []struct {
	Input   *s3manager.UploadInput
	Options []func(*s3manager.Uploader)
}

UploadCalls gets all the calls that were made to Upload. Check the length with:

len(mockedS3Writer.UploadCalls())

Jump to

Keyboard shortcuts

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