Documentation
¶
Overview ¶
Package mockuploads provides moq-generated mock implementations of the uploads package interfaces (UploadManager and the optional capability interfaces) for use in tests.
Index ¶
- type AttributerMock
- type ListerMock
- type RangeReaderMock
- type URLSignerMock
- type UploadManagerMock
- func (mock *UploadManagerMock) Delete(ctx context.Context, path string) error
- func (mock *UploadManagerMock) DeleteCalls() []struct{ ... }
- func (mock *UploadManagerMock) Exists(ctx context.Context, path string) (bool, error)
- func (mock *UploadManagerMock) ExistsCalls() []struct{ ... }
- func (mock *UploadManagerMock) Open(ctx context.Context, path string) (io.ReadCloser, error)
- func (mock *UploadManagerMock) OpenCalls() []struct{ ... }
- func (mock *UploadManagerMock) Save(ctx context.Context, path string, r io.Reader, opts ...uploads.SaveOption) error
- func (mock *UploadManagerMock) SaveCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttributerMock ¶
type AttributerMock struct {
// AttributesFunc mocks the Attributes method.
AttributesFunc func(ctx context.Context, path string) (*uploads.Attributes, error)
// contains filtered or unexported fields
}
AttributerMock is a mock implementation of uploads.Attributer.
func TestSomethingThatUsesAttributer(t *testing.T) {
// make and configure a mocked uploads.Attributer
mockedAttributer := &AttributerMock{
AttributesFunc: func(ctx context.Context, path string) (*uploads.Attributes, error) {
panic("mock out the Attributes method")
},
}
// use mockedAttributer in code that requires uploads.Attributer
// and then make assertions.
}
func (*AttributerMock) Attributes ¶
func (mock *AttributerMock) Attributes(ctx context.Context, path string) (*uploads.Attributes, error)
Attributes calls AttributesFunc.
func (*AttributerMock) AttributesCalls ¶
func (mock *AttributerMock) AttributesCalls() []struct { Ctx context.Context Path string }
AttributesCalls gets all the calls that were made to Attributes. Check the length with:
len(mockedAttributer.AttributesCalls())
type ListerMock ¶
type ListerMock struct {
// ListFunc mocks the List method.
ListFunc func(ctx context.Context, prefix string) iter.Seq2[uploads.ObjectInfo, error]
// contains filtered or unexported fields
}
ListerMock is a mock implementation of uploads.Lister.
func TestSomethingThatUsesLister(t *testing.T) {
// make and configure a mocked uploads.Lister
mockedLister := &ListerMock{
ListFunc: func(ctx context.Context, prefix string) iter.Seq2[uploads.ObjectInfo, error] {
panic("mock out the List method")
},
}
// use mockedLister in code that requires uploads.Lister
// and then make assertions.
}
type RangeReaderMock ¶
type RangeReaderMock struct {
// OpenRangeFunc mocks the OpenRange method.
OpenRangeFunc func(ctx context.Context, path string, offset int64, length int64) (io.ReadCloser, error)
// contains filtered or unexported fields
}
RangeReaderMock is a mock implementation of uploads.RangeReader.
func TestSomethingThatUsesRangeReader(t *testing.T) {
// make and configure a mocked uploads.RangeReader
mockedRangeReader := &RangeReaderMock{
OpenRangeFunc: func(ctx context.Context, path string, offset int64, length int64) (io.ReadCloser, error) {
panic("mock out the OpenRange method")
},
}
// use mockedRangeReader in code that requires uploads.RangeReader
// and then make assertions.
}
func (*RangeReaderMock) OpenRange ¶
func (mock *RangeReaderMock) OpenRange(ctx context.Context, path string, offset int64, length int64) (io.ReadCloser, error)
OpenRange calls OpenRangeFunc.
func (*RangeReaderMock) OpenRangeCalls ¶
func (mock *RangeReaderMock) OpenRangeCalls() []struct { Ctx context.Context Path string Offset int64 Length int64 }
OpenRangeCalls gets all the calls that were made to OpenRange. Check the length with:
len(mockedRangeReader.OpenRangeCalls())
type URLSignerMock ¶
type URLSignerMock struct {
// SignedURLFunc mocks the SignedURL method.
SignedURLFunc func(ctx context.Context, path string, opts *uploads.SignedURLOptions) (string, error)
// contains filtered or unexported fields
}
URLSignerMock is a mock implementation of uploads.URLSigner.
func TestSomethingThatUsesURLSigner(t *testing.T) {
// make and configure a mocked uploads.URLSigner
mockedURLSigner := &URLSignerMock{
SignedURLFunc: func(ctx context.Context, path string, opts *uploads.SignedURLOptions) (string, error) {
panic("mock out the SignedURL method")
},
}
// use mockedURLSigner in code that requires uploads.URLSigner
// and then make assertions.
}
func (*URLSignerMock) SignedURL ¶
func (mock *URLSignerMock) SignedURL(ctx context.Context, path string, opts *uploads.SignedURLOptions) (string, error)
SignedURL calls SignedURLFunc.
func (*URLSignerMock) SignedURLCalls ¶
func (mock *URLSignerMock) SignedURLCalls() []struct { Ctx context.Context Path string Opts *uploads.SignedURLOptions }
SignedURLCalls gets all the calls that were made to SignedURL. Check the length with:
len(mockedURLSigner.SignedURLCalls())
type UploadManagerMock ¶
type UploadManagerMock struct {
// DeleteFunc mocks the Delete method.
DeleteFunc func(ctx context.Context, path string) error
// ExistsFunc mocks the Exists method.
ExistsFunc func(ctx context.Context, path string) (bool, error)
// OpenFunc mocks the Open method.
OpenFunc func(ctx context.Context, path string) (io.ReadCloser, error)
// SaveFunc mocks the Save method.
SaveFunc func(ctx context.Context, path string, r io.Reader, opts ...uploads.SaveOption) error
// contains filtered or unexported fields
}
UploadManagerMock is a mock implementation of uploads.UploadManager.
func TestSomethingThatUsesUploadManager(t *testing.T) {
// make and configure a mocked uploads.UploadManager
mockedUploadManager := &UploadManagerMock{
DeleteFunc: func(ctx context.Context, path string) error {
panic("mock out the Delete method")
},
ExistsFunc: func(ctx context.Context, path string) (bool, error) {
panic("mock out the Exists method")
},
OpenFunc: func(ctx context.Context, path string) (io.ReadCloser, error) {
panic("mock out the Open method")
},
SaveFunc: func(ctx context.Context, path string, r io.Reader, opts ...uploads.SaveOption) error {
panic("mock out the Save method")
},
}
// use mockedUploadManager in code that requires uploads.UploadManager
// and then make assertions.
}
func (*UploadManagerMock) Delete ¶
func (mock *UploadManagerMock) Delete(ctx context.Context, path string) error
Delete calls DeleteFunc.
func (*UploadManagerMock) DeleteCalls ¶
func (mock *UploadManagerMock) DeleteCalls() []struct { Ctx context.Context Path string }
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedUploadManager.DeleteCalls())
func (*UploadManagerMock) ExistsCalls ¶
func (mock *UploadManagerMock) ExistsCalls() []struct { Ctx context.Context Path string }
ExistsCalls gets all the calls that were made to Exists. Check the length with:
len(mockedUploadManager.ExistsCalls())
func (*UploadManagerMock) Open ¶
func (mock *UploadManagerMock) Open(ctx context.Context, path string) (io.ReadCloser, error)
Open calls OpenFunc.
func (*UploadManagerMock) OpenCalls ¶
func (mock *UploadManagerMock) OpenCalls() []struct { Ctx context.Context Path string }
OpenCalls gets all the calls that were made to Open. Check the length with:
len(mockedUploadManager.OpenCalls())
func (*UploadManagerMock) Save ¶
func (mock *UploadManagerMock) Save(ctx context.Context, path string, r io.Reader, opts ...uploads.SaveOption) error
Save calls SaveFunc.
func (*UploadManagerMock) SaveCalls ¶
func (mock *UploadManagerMock) SaveCalls() []struct { Ctx context.Context Path string R io.Reader Opts []uploads.SaveOption }
SaveCalls gets all the calls that were made to Save. Check the length with:
len(mockedUploadManager.SaveCalls())