mock_s3manageriface

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockDownloader

type MockDownloader struct {
	// DownloadFunc mocks the Download method.
	DownloadFunc func(ctx context.Context, w io.WriterAt, input *s3.GetObjectInput, options ...func(*manager.Downloader)) (int64, error)
	// contains filtered or unexported fields
}

MockDownloader is a mock implementation of s3manageriface.Downloader.

func TestSomethingThatUsesDownloader(t *testing.T) {

	// make and configure a mocked s3manageriface.Downloader
	mockedDownloader := &MockDownloader{
		DownloadFunc: func(ctx context.Context, w io.WriterAt, input *s3.GetObjectInput, options ...func(*manager.Downloader)) (int64, error) {
			panic("mock out the Download method")
		},
	}

	// use mockedDownloader in code that requires s3manageriface.Downloader
	// and then make assertions.

}

func (*MockDownloader) Download

func (mock *MockDownloader) Download(ctx context.Context, w io.WriterAt, input *s3.GetObjectInput, options ...func(*manager.Downloader)) (int64, error)

Download calls DownloadFunc.

func (*MockDownloader) DownloadCalls

func (mock *MockDownloader) DownloadCalls() []struct {
	Ctx     context.Context
	W       io.WriterAt
	Input   *s3.GetObjectInput
	Options []func(*manager.Downloader)
}

DownloadCalls gets all the calls that were made to Download. Check the length with:

len(mockedDownloader.DownloadCalls())

type MockUploader

type MockUploader struct {
	// UploadFunc mocks the Upload method.
	UploadFunc func(ctx context.Context, input *s3.PutObjectInput, opts ...func(*manager.Uploader)) (*manager.UploadOutput, error)
	// contains filtered or unexported fields
}

MockUploader is a mock implementation of s3manageriface.Uploader.

func TestSomethingThatUsesUploader(t *testing.T) {

	// make and configure a mocked s3manageriface.Uploader
	mockedUploader := &MockUploader{
		UploadFunc: func(ctx context.Context, input *s3.PutObjectInput, opts ...func(*manager.Uploader)) (*manager.UploadOutput, error) {
			panic("mock out the Upload method")
		},
	}

	// use mockedUploader in code that requires s3manageriface.Uploader
	// and then make assertions.

}

func (*MockUploader) Upload

func (mock *MockUploader) Upload(ctx context.Context, input *s3.PutObjectInput, opts ...func(*manager.Uploader)) (*manager.UploadOutput, error)

Upload calls UploadFunc.

func (*MockUploader) UploadCalls

func (mock *MockUploader) UploadCalls() []struct {
	Ctx   context.Context
	Input *s3.PutObjectInput
	Opts  []func(*manager.Uploader)
}

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

len(mockedUploader.UploadCalls())

Jump to

Keyboard shortcuts

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