Documentation ¶
Index ¶
- Constants
- Variables
- type MockContents
- type MockS3Client
- func (m *MockS3Client) CopyObject(input *s3.CopyObjectInput) (*s3.CopyObjectOutput, error)
- func (m *MockS3Client) DeleteObject(input *s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)
- func (m *MockS3Client) GetObject(input *s3.GetObjectInput) (*s3.GetObjectOutput, error)
- func (m *MockS3Client) HeadObject(input *s3.HeadObjectInput) (*s3.HeadObjectOutput, error)
- func (m *MockS3Client) ListObjectsV2(input *s3.ListObjectsV2Input) (*s3.ListObjectsV2Output, error)
- func (m *MockS3Client) PutObject(input *s3.PutObjectInput) (*s3.PutObjectOutput, error)
Constants ¶
const (
// EmptyKeyError is used in the tests
EmptyKeyError = "empty key"
)
Variables ¶
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 ¶
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) 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.