mock

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 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 HandlerMock

type HandlerMock struct {
	// HandleFunc mocks the Handle method.
	HandleFunc func(ctx context.Context, ImageUploaded *event.ImageUploaded) error
	// contains filtered or unexported fields
}

HandlerMock is a mock implementation of event.Handler.

    func TestSomethingThatUsesHandler(t *testing.T) {

        // make and configure a mocked event.Handler
        mockedHandler := &HandlerMock{
            HandleFunc: func(ctx context.Context, ImageUploaded *event.ImageUploaded) error {
	               panic("mock out the Handle method")
            },
        }

        // use mockedHandler in code that requires event.Handler
        // and then make assertions.

    }

func (*HandlerMock) Handle

func (mock *HandlerMock) Handle(ctx context.Context, ImageUploaded *event.ImageUploaded) error

Handle calls HandleFunc.

func (*HandlerMock) HandleCalls

func (mock *HandlerMock) HandleCalls() []struct {
	Ctx           context.Context
	ImageUploaded *event.ImageUploaded
}

HandleCalls gets all the calls that were made to Handle. Check the length with:

len(mockedHandler.HandleCalls())

type ImageAPIClientMock

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

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

	// PostDownloadVariantFunc mocks the PostDownloadVariant method.
	PostDownloadVariantFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string, data image.NewImageDownload) (image.ImageDownload, 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")
            },
            GetImageFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string) (image.Image, error) {
	               panic("mock out the GetImage method")
            },
            PostDownloadVariantFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, imageID string, data image.NewImageDownload) (image.ImageDownload, error) {
	               panic("mock out the PostDownloadVariant 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

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

Checker calls CheckerFunc.

func (*ImageAPIClientMock) CheckerCalls

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) GetImage added in v0.7.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.7.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) PostDownloadVariant

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

PostDownloadVariant calls PostDownloadVariantFunc.

func (*ImageAPIClientMock) PostDownloadVariantCalls

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

PostDownloadVariantCalls gets all the calls that were made to PostDownloadVariant. Check the length with:

len(mockedImageAPIClient.PostDownloadVariantCalls())

func (*ImageAPIClientMock) PutDownloadVariant

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

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.7.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.7.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

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

func (mock *S3ReaderMock) BucketName() string

BucketName calls BucketNameFunc.

func (*S3ReaderMock) BucketNameCalls

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

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

Checker calls CheckerFunc.

func (*S3ReaderMock) CheckerCalls

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

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

Get calls GetFunc.

func (*S3ReaderMock) GetCalls

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

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

Session calls SessionFunc.

func (*S3ReaderMock) SessionCalls

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

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

len(mockedS3Reader.SessionCalls())

type S3WriterMock

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

func (mock *S3WriterMock) BucketName() string

BucketName calls BucketNameFunc.

func (*S3WriterMock) BucketNameCalls

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

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

Checker calls CheckerFunc.

func (*S3WriterMock) CheckerCalls

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

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

Session calls SessionFunc.

func (*S3WriterMock) SessionCalls

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

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

Upload calls UploadFunc.

func (*S3WriterMock) UploadCalls

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