mocks

package
v1.25.4 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EmptyKeyError is used in the tests
	EmptyKeyError = "empty key"
)

Variables

View Source
var (
	// ErrMaxKey is used in the tests
	ErrMaxKey = errors.New("max key error")
	// ErrKeyNotFound is used in the tests
	ErrKeyNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type MockContents

type MockContents map[string][]byte

MockContents stores the file inside the mocked S3 bucket.

type MockS3Client

type MockS3Client struct {
	s3iface.S3API
	Err           error
	Contents      MockContents
	DownloadError error
	MaxCalls      int

	Folders []string
	// contains filtered or unexported fields
}

MockS3Client can be used in tests to mock an S3 client.

func (*MockS3Client) CopyObject

func (m *MockS3Client) CopyObject(input *s3.CopyObjectInput) (*s3.CopyObjectOutput, error)

CopyObject returns an empty CopyObjectOutput object. If the mock client Err field is not nil, returns an error.

func (*MockS3Client) DeleteObject

func (m *MockS3Client) DeleteObject(input *s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)

DeleteObject returns an empty DeleteObjectOutput object. If the mock client Err field is not nil, returns an error.

func (*MockS3Client) DeleteObjects added in v1.23.5

func (m *MockS3Client) DeleteObjects(input *s3.DeleteObjectsInput) (*s3.DeleteObjectsOutput, error)

DeleteObjects returns an empty DeleteObjectOutput object. If the mock client Err field is not nil, returns an error.

func (*MockS3Client) GetObject

func (m *MockS3Client) GetObject(input *s3.GetObjectInput) (*s3.GetObjectOutput, error)

GetObject returns a GetObjectOutput object with the value of MockS3Client.Contents corresponding to that key. If the mock client Err field is not nil, returns an error.

func (*MockS3Client) HeadObject

func (m *MockS3Client) HeadObject(input *s3.HeadObjectInput) (*s3.HeadObjectOutput, error)

HeadObject returns an empty HeadObjectOutput and the mock client Err field.

func (*MockS3Client) ListObjectsV2

func (m *MockS3Client) ListObjectsV2(input *s3.ListObjectsV2Input) (*s3.ListObjectsV2Output, error)

ListObjectsV2 return the list of files it has using ListObjectsV2Output type

func (*MockS3Client) PutObject

func (m *MockS3Client) PutObject(input *s3.PutObjectInput) (*s3.PutObjectOutput, error)

PutObject returns an empty PutObjectOutput and the mock client Err field, if not nil. It also updates MockS3Client.Contents with the new input, if no Err is specified.

Jump to

Keyboard shortcuts

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