Documentation
¶
Index ¶
- type ClientMock
- func (mock *ClientMock) Pull(ctx context.Context, reference string, opts *oras.AuthOptions) (*oras.PullDescriptor, error)
- func (mock *ClientMock) PullCalls() []struct{ ... }
- func (mock *ClientMock) Push(ctx context.Context, reference string, descriptor *oras.PushDescriptor, ...) error
- func (mock *ClientMock) PushCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientMock ¶
type ClientMock struct {
// PullFunc mocks the Pull method.
PullFunc func(ctx context.Context, reference string, opts *oras.AuthOptions) (*oras.PullDescriptor, error)
// PushFunc mocks the Push method.
PushFunc func(ctx context.Context, reference string, descriptor *oras.PushDescriptor, opts *oras.AuthOptions) error
// contains filtered or unexported fields
}
ClientMock is a mock implementation of oras.Client.
func TestSomethingThatUsesClient(t *testing.T) {
// make and configure a mocked oras.Client
mockedClient := &ClientMock{
PullFunc: func(ctx context.Context, reference string, opts *oras.AuthOptions) (*oras.PullDescriptor, error) {
panic("mock out the Pull method")
},
PushFunc: func(ctx context.Context, reference string, descriptor *oras.PushDescriptor, opts *oras.AuthOptions) error {
panic("mock out the Push method")
},
}
// use mockedClient in code that requires oras.Client
// and then make assertions.
}
func (*ClientMock) Pull ¶
func (mock *ClientMock) Pull(ctx context.Context, reference string, opts *oras.AuthOptions) (*oras.PullDescriptor, error)
Pull calls PullFunc.
func (*ClientMock) PullCalls ¶
func (mock *ClientMock) PullCalls() []struct { Ctx context.Context Reference string Opts *oras.AuthOptions }
PullCalls gets all the calls that were made to Pull. Check the length with:
len(mockedClient.PullCalls())
func (*ClientMock) Push ¶
func (mock *ClientMock) Push(ctx context.Context, reference string, descriptor *oras.PushDescriptor, opts *oras.AuthOptions) error
Push calls PushFunc.
func (*ClientMock) PushCalls ¶
func (mock *ClientMock) PushCalls() []struct { Ctx context.Context Reference string Descriptor *oras.PushDescriptor Opts *oras.AuthOptions }
PushCalls gets all the calls that were made to Push. Check the length with:
len(mockedClient.PushCalls())
Click to show internal directories.
Click to hide internal directories.