Documentation
¶
Overview ¶
Package usecasetest provides test helpers for the generic usecase package
Package usecasetest Usecase test utils
Index ¶
- func AssertListResults[R, I resource.Resource](t *testing.T, uc usecase.Lister[R], testDef UsecaseListerTestDef[R], ...)
- type Creator
- type CreatorBatch
- type CreatorBatch_CreateBatch_Call
- func (_c *CreatorBatch_CreateBatch_Call[R]) Return(vs []R, err error) *CreatorBatch_CreateBatch_Call[R]
- func (_c *CreatorBatch_CreateBatch_Call[R]) Run(run func(ctx context.Context, r []R)) *CreatorBatch_CreateBatch_Call[R]
- func (_c *CreatorBatch_CreateBatch_Call[R]) RunAndReturn(run func(ctx context.Context, r []R) ([]R, error)) *CreatorBatch_CreateBatch_Call[R]
- type CreatorBatch_Expecter
- type Creator_Create_Call
- type Creator_Expecter
- type Deleter
- type Deleter_Delete_Call
- type Deleter_Expecter
- type Getter
- type GetterStub
- type Getter_Expecter
- type Getter_Get_Call
- func (_c *Getter_Get_Call[R]) Return(v R, err error) *Getter_Get_Call[R]
- func (_c *Getter_Get_Call[R]) Run(run func(ctx context.Context, opts ...search.Option)) *Getter_Get_Call[R]
- func (_c *Getter_Get_Call[R]) RunAndReturn(run func(ctx context.Context, opts ...search.Option) (R, error)) *Getter_Get_Call[R]
- type Lister
- type ListerStub
- type Lister_Expecter
- type Lister_List_Call
- type Patcher
- type PatcherBatch
- type PatcherBatch_Expecter
- type PatcherBatch_PatchBatch_Call
- func (_c *PatcherBatch_PatchBatch_Call[T, R]) Return(_a0 []R, _a1 error) *PatcherBatch_PatchBatch_Call[T, R]
- func (_c *PatcherBatch_PatchBatch_Call[T, R]) Run(run func(ctx context.Context, req T)) *PatcherBatch_PatchBatch_Call[T, R]
- func (_c *PatcherBatch_PatchBatch_Call[T, R]) RunAndReturn(run func(context.Context, T) ([]R, error)) *PatcherBatch_PatchBatch_Call[T, R]
- type Patcher_Expecter
- type Patcher_Patch_Call
- func (_c *Patcher_Patch_Call[R]) Return(v R, err error) *Patcher_Patch_Call[R]
- func (_c *Patcher_Patch_Call[R]) Run(run func(ctx context.Context, opts ...repository.PatchOption)) *Patcher_Patch_Call[R]
- func (_c *Patcher_Patch_Call[R]) RunAndReturn(run func(ctx context.Context, opts ...repository.PatchOption) (R, error)) *Patcher_Patch_Call[R]
- type StubOption
- type Updater
- type Updater_Expecter
- type Updater_Update_Call
- func (_c *Updater_Update_Call[R]) Return(v R, err error) *Updater_Update_Call[R]
- func (_c *Updater_Update_Call[R]) Run(run func(ctx context.Context, req R)) *Updater_Update_Call[R]
- func (_c *Updater_Update_Call[R]) RunAndReturn(run func(ctx context.Context, req R) (R, error)) *Updater_Update_Call[R]
- type UsecaseListerTestDef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertListResults ¶
func AssertListResults[R, I resource.Resource]( t *testing.T, uc usecase.Lister[R], testDef UsecaseListerTestDef[R], assertResultFn func(t *testing.T, expect, actual R, opts ...resourcetest.AssertOption), assertIncludeFn func(t *testing.T, expect, actual I, opts ...resourcetest.AssertOption), )
Types ¶
type Creator ¶
Creator is an autogenerated mock type for the Creator type
func NewCreator ¶
NewCreator creates a new instance of Creator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*Creator[R]) EXPECT ¶
func (_m *Creator[R]) EXPECT() *Creator_Expecter[R]
type CreatorBatch ¶
CreatorBatch is an autogenerated mock type for the CreatorBatch type
func NewCreatorBatch ¶
func NewCreatorBatch[R resource.Resource](t interface { mock.TestingT Cleanup(func()) }) *CreatorBatch[R]
NewCreatorBatch creates a new instance of CreatorBatch. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*CreatorBatch[R]) CreateBatch ¶
func (_mock *CreatorBatch[R]) CreateBatch(ctx context.Context, r []R) ([]R, error)
CreateBatch provides a mock function for the type CreatorBatch
func (*CreatorBatch[R]) EXPECT ¶
func (_m *CreatorBatch[R]) EXPECT() *CreatorBatch_Expecter[R]
type CreatorBatch_CreateBatch_Call ¶
CreatorBatch_CreateBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateBatch'
func (*CreatorBatch_CreateBatch_Call[R]) Return ¶
func (_c *CreatorBatch_CreateBatch_Call[R]) Return(vs []R, err error) *CreatorBatch_CreateBatch_Call[R]
func (*CreatorBatch_CreateBatch_Call[R]) Run ¶
func (_c *CreatorBatch_CreateBatch_Call[R]) Run(run func(ctx context.Context, r []R)) *CreatorBatch_CreateBatch_Call[R]
func (*CreatorBatch_CreateBatch_Call[R]) RunAndReturn ¶
func (_c *CreatorBatch_CreateBatch_Call[R]) RunAndReturn(run func(ctx context.Context, r []R) ([]R, error)) *CreatorBatch_CreateBatch_Call[R]
type CreatorBatch_Expecter ¶
type CreatorBatch_Expecter[R resource.Resource] struct { // contains filtered or unexported fields }
func (*CreatorBatch_Expecter[R]) CreateBatch ¶
func (_e *CreatorBatch_Expecter[R]) CreateBatch(ctx interface{}, r interface{}) *CreatorBatch_CreateBatch_Call[R]
CreateBatch is a helper method to define mock.On call
- ctx context.Context
- r []R
type Creator_Create_Call ¶
Creator_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'
func (*Creator_Create_Call[R]) Return ¶
func (_c *Creator_Create_Call[R]) Return(v R, err error) *Creator_Create_Call[R]
func (*Creator_Create_Call[R]) Run ¶
func (_c *Creator_Create_Call[R]) Run(run func(ctx context.Context, r R)) *Creator_Create_Call[R]
func (*Creator_Create_Call[R]) RunAndReturn ¶
func (_c *Creator_Create_Call[R]) RunAndReturn(run func(ctx context.Context, r R) (R, error)) *Creator_Create_Call[R]
type Creator_Expecter ¶
func (*Creator_Expecter[R]) Create ¶
func (_e *Creator_Expecter[R]) Create(ctx interface{}, r interface{}) *Creator_Create_Call[R]
Create is a helper method to define mock.On call
- ctx context.Context
- r R
type Deleter ¶
Deleter is an autogenerated mock type for the Deleter type
func NewDeleter ¶
NewDeleter creates a new instance of Deleter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*Deleter) Delete ¶
func (_mock *Deleter) Delete(context1 context.Context, deleteType repository.DeleteType, options ...search.Option) error
Delete provides a mock function for the type Deleter
func (*Deleter) EXPECT ¶
func (_m *Deleter) EXPECT() *Deleter_Expecter
type Deleter_Delete_Call ¶
Deleter_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
func (*Deleter_Delete_Call) Return ¶
func (_c *Deleter_Delete_Call) Return(err error) *Deleter_Delete_Call
func (*Deleter_Delete_Call) Run ¶
func (_c *Deleter_Delete_Call) Run(run func(context1 context.Context, deleteType repository.DeleteType, options ...search.Option)) *Deleter_Delete_Call
func (*Deleter_Delete_Call) RunAndReturn ¶
func (_c *Deleter_Delete_Call) RunAndReturn(run func(context1 context.Context, deleteType repository.DeleteType, options ...search.Option) error) *Deleter_Delete_Call
type Deleter_Expecter ¶
type Deleter_Expecter struct {
// contains filtered or unexported fields
}
func (*Deleter_Expecter) Delete ¶
func (_e *Deleter_Expecter) Delete(context1 interface{}, deleteType interface{}, options ...interface{}) *Deleter_Delete_Call
Delete is a helper method to define mock.On call
- context1 context.Context
- deleteType repository.DeleteType
- options ...search.Option
type Getter ¶
Getter is an autogenerated mock type for the Getter type
func NewGetter ¶
NewGetter creates a new instance of Getter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*Getter[R]) EXPECT ¶
func (_m *Getter[R]) EXPECT() *Getter_Expecter[R]
type GetterStub ¶
func NewGetterStub ¶
func NewGetterStub[R resource.Resource](res R, err error, opts ...StubOption) *GetterStub[R]
type Getter_Expecter ¶
func (*Getter_Expecter[R]) Get ¶
func (_e *Getter_Expecter[R]) Get(ctx interface{}, opts ...interface{}) *Getter_Get_Call[R]
Get is a helper method to define mock.On call
- ctx context.Context
- opts ...search.Option
type Getter_Get_Call ¶
Getter_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
func (*Getter_Get_Call[R]) Return ¶
func (_c *Getter_Get_Call[R]) Return(v R, err error) *Getter_Get_Call[R]
func (*Getter_Get_Call[R]) Run ¶
func (_c *Getter_Get_Call[R]) Run(run func(ctx context.Context, opts ...search.Option)) *Getter_Get_Call[R]
func (*Getter_Get_Call[R]) RunAndReturn ¶
func (_c *Getter_Get_Call[R]) RunAndReturn(run func(ctx context.Context, opts ...search.Option) (R, error)) *Getter_Get_Call[R]
type Lister ¶
Lister is an autogenerated mock type for the Lister type
func NewLister ¶
NewLister creates a new instance of Lister. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*Lister[R]) EXPECT ¶
func (_m *Lister[R]) EXPECT() *Lister_Expecter[R]
type ListerStub ¶
func NewListerStub ¶
func NewListerStub[R resource.Resource](res resource.ListResponse[R], err error, opts ...StubOption) *ListerStub[R]
func (*ListerStub[R]) List ¶
func (ls *ListerStub[R]) List(ctx context.Context, opts ...search.Option) (resource.ListResponse[R], error)
type Lister_Expecter ¶
func (*Lister_Expecter[R]) List ¶
func (_e *Lister_Expecter[R]) List(ctx interface{}, opts ...interface{}) *Lister_List_Call[R]
List is a helper method to define mock.On call
- ctx context.Context
- opts ...search.Option
type Lister_List_Call ¶
Lister_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
func (*Lister_List_Call[R]) Return ¶
func (_c *Lister_List_Call[R]) Return(listResponse resource.ListResponse[R], err error) *Lister_List_Call[R]
func (*Lister_List_Call[R]) Run ¶
func (_c *Lister_List_Call[R]) Run(run func(ctx context.Context, opts ...search.Option)) *Lister_List_Call[R]
func (*Lister_List_Call[R]) RunAndReturn ¶
func (_c *Lister_List_Call[R]) RunAndReturn(run func(ctx context.Context, opts ...search.Option) (resource.ListResponse[R], error)) *Lister_List_Call[R]
type Patcher ¶
Patcher is an autogenerated mock type for the Patcher type
func NewPatcher ¶
NewPatcher creates a new instance of Patcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*Patcher[R]) EXPECT ¶
func (_m *Patcher[R]) EXPECT() *Patcher_Expecter[R]
func (*Patcher[R]) Patch ¶
func (_mock *Patcher[R]) Patch(ctx context.Context, opts ...repository.PatchOption) (R, error)
Patch provides a mock function for the type Patcher
type PatcherBatch ¶
PatcherBatch is an autogenerated mock type for the PatcherBatch type
func NewPatcherBatch ¶
func NewPatcherBatch[T resource.Resource, R resource.Resource](t interface { mock.TestingT Cleanup(func()) }) *PatcherBatch[T, R]
NewPatcherBatch creates a new instance of PatcherBatch. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*PatcherBatch[T, R]) EXPECT ¶
func (_m *PatcherBatch[T, R]) EXPECT() *PatcherBatch_Expecter[T, R]
func (*PatcherBatch[T, R]) PatchBatch ¶
func (_m *PatcherBatch[T, R]) PatchBatch(ctx context.Context, req T) ([]R, error)
PatchBatch provides a mock function with given fields: ctx, req
type PatcherBatch_Expecter ¶
type PatcherBatch_Expecter[T resource.Resource, R resource.Resource] struct { // contains filtered or unexported fields }
func (*PatcherBatch_Expecter[T, R]) PatchBatch ¶
func (_e *PatcherBatch_Expecter[T, R]) PatchBatch(ctx interface{}, req interface{}) *PatcherBatch_PatchBatch_Call[T, R]
PatchBatch is a helper method to define mock.On call
- ctx context.Context
- req T
type PatcherBatch_PatchBatch_Call ¶
PatcherBatch_PatchBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PatchBatch'
func (*PatcherBatch_PatchBatch_Call[T, R]) Return ¶
func (_c *PatcherBatch_PatchBatch_Call[T, R]) Return(_a0 []R, _a1 error) *PatcherBatch_PatchBatch_Call[T, R]
func (*PatcherBatch_PatchBatch_Call[T, R]) Run ¶
func (_c *PatcherBatch_PatchBatch_Call[T, R]) Run(run func(ctx context.Context, req T)) *PatcherBatch_PatchBatch_Call[T, R]
func (*PatcherBatch_PatchBatch_Call[T, R]) RunAndReturn ¶
func (_c *PatcherBatch_PatchBatch_Call[T, R]) RunAndReturn(run func(context.Context, T) ([]R, error)) *PatcherBatch_PatchBatch_Call[T, R]
type Patcher_Expecter ¶
type Patcher_Expecter[R any] struct { // contains filtered or unexported fields }
func (*Patcher_Expecter[R]) Patch ¶
func (_e *Patcher_Expecter[R]) Patch(ctx interface{}, opts ...interface{}) *Patcher_Patch_Call[R]
Patch is a helper method to define mock.On call
- ctx context.Context
- opts ...repository.PatchOption
type Patcher_Patch_Call ¶
Patcher_Patch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Patch'
func (*Patcher_Patch_Call[R]) Return ¶
func (_c *Patcher_Patch_Call[R]) Return(v R, err error) *Patcher_Patch_Call[R]
func (*Patcher_Patch_Call[R]) Run ¶
func (_c *Patcher_Patch_Call[R]) Run(run func(ctx context.Context, opts ...repository.PatchOption)) *Patcher_Patch_Call[R]
func (*Patcher_Patch_Call[R]) RunAndReturn ¶
func (_c *Patcher_Patch_Call[R]) RunAndReturn(run func(ctx context.Context, opts ...repository.PatchOption) (R, error)) *Patcher_Patch_Call[R]
type StubOption ¶
type StubOption func(c *stubConfig)
func WithStubInterceptor ¶
func WithStubInterceptor(f func(ctx context.Context, opts ...search.Option)) StubOption
type Updater ¶
Updater is an autogenerated mock type for the Updater type
func NewUpdater ¶
NewUpdater creates a new instance of Updater. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*Updater[R]) EXPECT ¶
func (_m *Updater[R]) EXPECT() *Updater_Expecter[R]
type Updater_Expecter ¶
func (*Updater_Expecter[R]) Update ¶
func (_e *Updater_Expecter[R]) Update(ctx interface{}, req interface{}) *Updater_Update_Call[R]
Update is a helper method to define mock.On call
- ctx context.Context
- req R
type Updater_Update_Call ¶
Updater_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'
func (*Updater_Update_Call[R]) Return ¶
func (_c *Updater_Update_Call[R]) Return(v R, err error) *Updater_Update_Call[R]
func (*Updater_Update_Call[R]) Run ¶
func (_c *Updater_Update_Call[R]) Run(run func(ctx context.Context, req R)) *Updater_Update_Call[R]
func (*Updater_Update_Call[R]) RunAndReturn ¶
func (_c *Updater_Update_Call[R]) RunAndReturn(run func(ctx context.Context, req R) (R, error)) *Updater_Update_Call[R]