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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilesServiceMock added in v1.3.0

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

	// MarkFileMovedFunc mocks the MarkFileMoved method.
	MarkFileMovedFunc func(ctx context.Context, path string, etag string) error
	// contains filtered or unexported fields
}

FilesServiceMock is a mock implementation of file.FilesService.

func TestSomethingThatUsesFilesService(t *testing.T) {

	// make and configure a mocked file.FilesService
	mockedFilesService := &FilesServiceMock{
		CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		MarkFileMovedFunc: func(ctx context.Context, path string, etag string) error {
			panic("mock out the MarkFileMoved method")
		},
	}

	// use mockedFilesService in code that requires file.FilesService
	// and then make assertions.

}

func (*FilesServiceMock) Checker added in v1.3.0

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

Checker calls CheckerFunc.

func (*FilesServiceMock) CheckerCalls added in v1.3.0

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

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

len(mockedFilesService.CheckerCalls())

func (*FilesServiceMock) MarkFileMoved added in v1.3.0

func (mock *FilesServiceMock) MarkFileMoved(ctx context.Context, path string, etag string) error

MarkFileMoved calls MarkFileMovedFunc.

func (*FilesServiceMock) MarkFileMovedCalls added in v1.3.0

func (mock *FilesServiceMock) MarkFileMovedCalls() []struct {
	Ctx  context.Context
	Path string
	Etag string
}

MarkFileMovedCalls gets all the calls that were made to MarkFileMoved. Check the length with:

len(mockedFilesService.MarkFileMovedCalls())

type S3ClientV2Mock

type S3ClientV2Mock struct {
	// FileExistsFunc mocks the FileExists method.
	FileExistsFunc func(key string) (bool, error)

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

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

S3ClientV2Mock is a mock implementation of file.S3ClientV2.

func TestSomethingThatUsesS3ClientV2(t *testing.T) {

	// make and configure a mocked file.S3ClientV2
	mockedS3ClientV2 := &S3ClientV2Mock{
		FileExistsFunc: func(key string) (bool, error) {
			panic("mock out the FileExists method")
		},
		GetFunc: func(key string) (io.ReadCloser, *int64, error) {
			panic("mock out the Get method")
		},
		UploadFunc: func(input *s3manager.UploadInput, options ...func(*s3manager.Uploader)) (*s3manager.UploadOutput, error) {
			panic("mock out the Upload method")
		},
	}

	// use mockedS3ClientV2 in code that requires file.S3ClientV2
	// and then make assertions.

}

func (*S3ClientV2Mock) FileExists

func (mock *S3ClientV2Mock) FileExists(key string) (bool, error)

FileExists calls FileExistsFunc.

func (*S3ClientV2Mock) FileExistsCalls

func (mock *S3ClientV2Mock) FileExistsCalls() []struct {
	Key string
}

FileExistsCalls gets all the calls that were made to FileExists. Check the length with:

len(mockedS3ClientV2.FileExistsCalls())

func (*S3ClientV2Mock) Get added in v1.3.0

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

Get calls GetFunc.

func (*S3ClientV2Mock) GetCalls added in v1.3.0

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

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

len(mockedS3ClientV2.GetCalls())

func (*S3ClientV2Mock) Upload

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

Upload calls UploadFunc.

func (*S3ClientV2Mock) UploadCalls

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

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

len(mockedS3ClientV2.UploadCalls())

Jump to

Keyboard shortcuts

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