|
@@ -0,0 +1,1143 @@
|
|
|
+// Code generated by http://github.com/gojuno/minimock (v3.3.13). DO NOT EDIT.
|
|
|
+
|
|
|
+package mocks
|
|
|
+
|
|
|
+//go:generate minimock -i git.dmitriygnatenko.ru/dima/homethings/internal/api/v1/tag.ThingTagRepository -o thing_tag_repository_minimock.go -n ThingTagRepositoryMock -p mocks
|
|
|
+
|
|
|
+import (
|
|
|
+ "context"
|
|
|
+ "database/sql"
|
|
|
+ "sync"
|
|
|
+ mm_atomic "sync/atomic"
|
|
|
+ mm_time "time"
|
|
|
+
|
|
|
+ "git.dmitriygnatenko.ru/dima/homethings/internal/models"
|
|
|
+ "github.com/gojuno/minimock/v3"
|
|
|
+)
|
|
|
+
|
|
|
+// ThingTagRepositoryMock implements tag.ThingTagRepository
|
|
|
+type ThingTagRepositoryMock struct {
|
|
|
+ t minimock.Tester
|
|
|
+ finishOnce sync.Once
|
|
|
+
|
|
|
+ funcAdd func(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx) (err error)
|
|
|
+ inspectFuncAdd func(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx)
|
|
|
+ afterAddCounter uint64
|
|
|
+ beforeAddCounter uint64
|
|
|
+ AddMock mThingTagRepositoryMockAdd
|
|
|
+
|
|
|
+ funcDelete func(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx) (err error)
|
|
|
+ inspectFuncDelete func(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx)
|
|
|
+ afterDeleteCounter uint64
|
|
|
+ beforeDeleteCounter uint64
|
|
|
+ DeleteMock mThingTagRepositoryMockDelete
|
|
|
+
|
|
|
+ funcDeleteByTagID func(ctx context.Context, tagID int, tx *sql.Tx) (err error)
|
|
|
+ inspectFuncDeleteByTagID func(ctx context.Context, tagID int, tx *sql.Tx)
|
|
|
+ afterDeleteByTagIDCounter uint64
|
|
|
+ beforeDeleteByTagIDCounter uint64
|
|
|
+ DeleteByTagIDMock mThingTagRepositoryMockDeleteByTagID
|
|
|
+}
|
|
|
+
|
|
|
+// NewThingTagRepositoryMock returns a mock for tag.ThingTagRepository
|
|
|
+func NewThingTagRepositoryMock(t minimock.Tester) *ThingTagRepositoryMock {
|
|
|
+ m := &ThingTagRepositoryMock{t: t}
|
|
|
+
|
|
|
+ if controller, ok := t.(minimock.MockController); ok {
|
|
|
+ controller.RegisterMocker(m)
|
|
|
+ }
|
|
|
+
|
|
|
+ m.AddMock = mThingTagRepositoryMockAdd{mock: m}
|
|
|
+ m.AddMock.callArgs = []*ThingTagRepositoryMockAddParams{}
|
|
|
+
|
|
|
+ m.DeleteMock = mThingTagRepositoryMockDelete{mock: m}
|
|
|
+ m.DeleteMock.callArgs = []*ThingTagRepositoryMockDeleteParams{}
|
|
|
+
|
|
|
+ m.DeleteByTagIDMock = mThingTagRepositoryMockDeleteByTagID{mock: m}
|
|
|
+ m.DeleteByTagIDMock.callArgs = []*ThingTagRepositoryMockDeleteByTagIDParams{}
|
|
|
+
|
|
|
+ t.Cleanup(m.MinimockFinish)
|
|
|
+
|
|
|
+ return m
|
|
|
+}
|
|
|
+
|
|
|
+type mThingTagRepositoryMockAdd struct {
|
|
|
+ optional bool
|
|
|
+ mock *ThingTagRepositoryMock
|
|
|
+ defaultExpectation *ThingTagRepositoryMockAddExpectation
|
|
|
+ expectations []*ThingTagRepositoryMockAddExpectation
|
|
|
+
|
|
|
+ callArgs []*ThingTagRepositoryMockAddParams
|
|
|
+ mutex sync.RWMutex
|
|
|
+
|
|
|
+ expectedInvocations uint64
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockAddExpectation specifies expectation struct of the ThingTagRepository.Add
|
|
|
+type ThingTagRepositoryMockAddExpectation struct {
|
|
|
+ mock *ThingTagRepositoryMock
|
|
|
+ params *ThingTagRepositoryMockAddParams
|
|
|
+ paramPtrs *ThingTagRepositoryMockAddParamPtrs
|
|
|
+ results *ThingTagRepositoryMockAddResults
|
|
|
+ Counter uint64
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockAddParams contains parameters of the ThingTagRepository.Add
|
|
|
+type ThingTagRepositoryMockAddParams struct {
|
|
|
+ ctx context.Context
|
|
|
+ req models.AddThingTagRequest
|
|
|
+ tx *sql.Tx
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockAddParamPtrs contains pointers to parameters of the ThingTagRepository.Add
|
|
|
+type ThingTagRepositoryMockAddParamPtrs struct {
|
|
|
+ ctx *context.Context
|
|
|
+ req *models.AddThingTagRequest
|
|
|
+ tx **sql.Tx
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockAddResults contains results of the ThingTagRepository.Add
|
|
|
+type ThingTagRepositoryMockAddResults struct {
|
|
|
+ err error
|
|
|
+}
|
|
|
+
|
|
|
+// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
|
|
|
+// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
|
|
|
+// Optional() makes method check to work in '0 or more' mode.
|
|
|
+// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
|
|
|
+// catch the problems when the expected method call is totally skipped during test run.
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) Optional() *mThingTagRepositoryMockAdd {
|
|
|
+ mmAdd.optional = true
|
|
|
+ return mmAdd
|
|
|
+}
|
|
|
+
|
|
|
+// Expect sets up expected params for ThingTagRepository.Add
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) Expect(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx) *mThingTagRepositoryMockAdd {
|
|
|
+ if mmAdd.mock.funcAdd != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation == nil {
|
|
|
+ mmAdd.defaultExpectation = &ThingTagRepositoryMockAddExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation.paramPtrs != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by ExpectParams functions")
|
|
|
+ }
|
|
|
+
|
|
|
+ mmAdd.defaultExpectation.params = &ThingTagRepositoryMockAddParams{ctx, req, tx}
|
|
|
+ for _, e := range mmAdd.expectations {
|
|
|
+ if minimock.Equal(e.params, mmAdd.defaultExpectation.params) {
|
|
|
+ mmAdd.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmAdd.defaultExpectation.params)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return mmAdd
|
|
|
+}
|
|
|
+
|
|
|
+// ExpectCtxParam1 sets up expected param ctx for ThingTagRepository.Add
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) ExpectCtxParam1(ctx context.Context) *mThingTagRepositoryMockAdd {
|
|
|
+ if mmAdd.mock.funcAdd != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation == nil {
|
|
|
+ mmAdd.defaultExpectation = &ThingTagRepositoryMockAddExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation.params != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmAdd.defaultExpectation.paramPtrs = &ThingTagRepositoryMockAddParamPtrs{}
|
|
|
+ }
|
|
|
+ mmAdd.defaultExpectation.paramPtrs.ctx = &ctx
|
|
|
+
|
|
|
+ return mmAdd
|
|
|
+}
|
|
|
+
|
|
|
+// ExpectReqParam2 sets up expected param req for ThingTagRepository.Add
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) ExpectReqParam2(req models.AddThingTagRequest) *mThingTagRepositoryMockAdd {
|
|
|
+ if mmAdd.mock.funcAdd != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation == nil {
|
|
|
+ mmAdd.defaultExpectation = &ThingTagRepositoryMockAddExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation.params != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmAdd.defaultExpectation.paramPtrs = &ThingTagRepositoryMockAddParamPtrs{}
|
|
|
+ }
|
|
|
+ mmAdd.defaultExpectation.paramPtrs.req = &req
|
|
|
+
|
|
|
+ return mmAdd
|
|
|
+}
|
|
|
+
|
|
|
+// ExpectTxParam3 sets up expected param tx for ThingTagRepository.Add
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) ExpectTxParam3(tx *sql.Tx) *mThingTagRepositoryMockAdd {
|
|
|
+ if mmAdd.mock.funcAdd != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation == nil {
|
|
|
+ mmAdd.defaultExpectation = &ThingTagRepositoryMockAddExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation.params != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmAdd.defaultExpectation.paramPtrs = &ThingTagRepositoryMockAddParamPtrs{}
|
|
|
+ }
|
|
|
+ mmAdd.defaultExpectation.paramPtrs.tx = &tx
|
|
|
+
|
|
|
+ return mmAdd
|
|
|
+}
|
|
|
+
|
|
|
+// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.Add
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) Inspect(f func(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx)) *mThingTagRepositoryMockAdd {
|
|
|
+ if mmAdd.mock.inspectFuncAdd != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.Add")
|
|
|
+ }
|
|
|
+
|
|
|
+ mmAdd.mock.inspectFuncAdd = f
|
|
|
+
|
|
|
+ return mmAdd
|
|
|
+}
|
|
|
+
|
|
|
+// Return sets up results that will be returned by ThingTagRepository.Add
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) Return(err error) *ThingTagRepositoryMock {
|
|
|
+ if mmAdd.mock.funcAdd != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.defaultExpectation == nil {
|
|
|
+ mmAdd.defaultExpectation = &ThingTagRepositoryMockAddExpectation{mock: mmAdd.mock}
|
|
|
+ }
|
|
|
+ mmAdd.defaultExpectation.results = &ThingTagRepositoryMockAddResults{err}
|
|
|
+ return mmAdd.mock
|
|
|
+}
|
|
|
+
|
|
|
+// Set uses given function f to mock the ThingTagRepository.Add method
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) Set(f func(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx) (err error)) *ThingTagRepositoryMock {
|
|
|
+ if mmAdd.defaultExpectation != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.Add method")
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(mmAdd.expectations) > 0 {
|
|
|
+ mmAdd.mock.t.Fatalf("Some expectations are already set for the ThingTagRepository.Add method")
|
|
|
+ }
|
|
|
+
|
|
|
+ mmAdd.mock.funcAdd = f
|
|
|
+ return mmAdd.mock
|
|
|
+}
|
|
|
+
|
|
|
+// When sets expectation for the ThingTagRepository.Add which will trigger the result defined by the following
|
|
|
+// Then helper
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) When(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx) *ThingTagRepositoryMockAddExpectation {
|
|
|
+ if mmAdd.mock.funcAdd != nil {
|
|
|
+ mmAdd.mock.t.Fatalf("ThingTagRepositoryMock.Add mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ expectation := &ThingTagRepositoryMockAddExpectation{
|
|
|
+ mock: mmAdd.mock,
|
|
|
+ params: &ThingTagRepositoryMockAddParams{ctx, req, tx},
|
|
|
+ }
|
|
|
+ mmAdd.expectations = append(mmAdd.expectations, expectation)
|
|
|
+ return expectation
|
|
|
+}
|
|
|
+
|
|
|
+// Then sets up ThingTagRepository.Add return parameters for the expectation previously defined by the When method
|
|
|
+func (e *ThingTagRepositoryMockAddExpectation) Then(err error) *ThingTagRepositoryMock {
|
|
|
+ e.results = &ThingTagRepositoryMockAddResults{err}
|
|
|
+ return e.mock
|
|
|
+}
|
|
|
+
|
|
|
+// Times sets number of times ThingTagRepository.Add should be invoked
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) Times(n uint64) *mThingTagRepositoryMockAdd {
|
|
|
+ if n == 0 {
|
|
|
+ mmAdd.mock.t.Fatalf("Times of ThingTagRepositoryMock.Add mock can not be zero")
|
|
|
+ }
|
|
|
+ mm_atomic.StoreUint64(&mmAdd.expectedInvocations, n)
|
|
|
+ return mmAdd
|
|
|
+}
|
|
|
+
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) invocationsDone() bool {
|
|
|
+ if len(mmAdd.expectations) == 0 && mmAdd.defaultExpectation == nil && mmAdd.mock.funcAdd == nil {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ totalInvocations := mm_atomic.LoadUint64(&mmAdd.mock.afterAddCounter)
|
|
|
+ expectedInvocations := mm_atomic.LoadUint64(&mmAdd.expectedInvocations)
|
|
|
+
|
|
|
+ return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
|
|
|
+}
|
|
|
+
|
|
|
+// Add implements tag.ThingTagRepository
|
|
|
+func (mmAdd *ThingTagRepositoryMock) Add(ctx context.Context, req models.AddThingTagRequest, tx *sql.Tx) (err error) {
|
|
|
+ mm_atomic.AddUint64(&mmAdd.beforeAddCounter, 1)
|
|
|
+ defer mm_atomic.AddUint64(&mmAdd.afterAddCounter, 1)
|
|
|
+
|
|
|
+ if mmAdd.inspectFuncAdd != nil {
|
|
|
+ mmAdd.inspectFuncAdd(ctx, req, tx)
|
|
|
+ }
|
|
|
+
|
|
|
+ mm_params := ThingTagRepositoryMockAddParams{ctx, req, tx}
|
|
|
+
|
|
|
+ // Record call args
|
|
|
+ mmAdd.AddMock.mutex.Lock()
|
|
|
+ mmAdd.AddMock.callArgs = append(mmAdd.AddMock.callArgs, &mm_params)
|
|
|
+ mmAdd.AddMock.mutex.Unlock()
|
|
|
+
|
|
|
+ for _, e := range mmAdd.AddMock.expectations {
|
|
|
+ if minimock.Equal(*e.params, mm_params) {
|
|
|
+ mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
+ return e.results.err
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmAdd.AddMock.defaultExpectation != nil {
|
|
|
+ mm_atomic.AddUint64(&mmAdd.AddMock.defaultExpectation.Counter, 1)
|
|
|
+ mm_want := mmAdd.AddMock.defaultExpectation.params
|
|
|
+ mm_want_ptrs := mmAdd.AddMock.defaultExpectation.paramPtrs
|
|
|
+
|
|
|
+ mm_got := ThingTagRepositoryMockAddParams{ctx, req, tx}
|
|
|
+
|
|
|
+ if mm_want_ptrs != nil {
|
|
|
+
|
|
|
+ if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
|
|
|
+ mmAdd.t.Errorf("ThingTagRepositoryMock.Add got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
|
|
|
+ }
|
|
|
+
|
|
|
+ if mm_want_ptrs.req != nil && !minimock.Equal(*mm_want_ptrs.req, mm_got.req) {
|
|
|
+ mmAdd.t.Errorf("ThingTagRepositoryMock.Add got unexpected parameter req, want: %#v, got: %#v%s\n", *mm_want_ptrs.req, mm_got.req, minimock.Diff(*mm_want_ptrs.req, mm_got.req))
|
|
|
+ }
|
|
|
+
|
|
|
+ if mm_want_ptrs.tx != nil && !minimock.Equal(*mm_want_ptrs.tx, mm_got.tx) {
|
|
|
+ mmAdd.t.Errorf("ThingTagRepositoryMock.Add got unexpected parameter tx, want: %#v, got: %#v%s\n", *mm_want_ptrs.tx, mm_got.tx, minimock.Diff(*mm_want_ptrs.tx, mm_got.tx))
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
+ mmAdd.t.Errorf("ThingTagRepositoryMock.Add got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
+ }
|
|
|
+
|
|
|
+ mm_results := mmAdd.AddMock.defaultExpectation.results
|
|
|
+ if mm_results == nil {
|
|
|
+ mmAdd.t.Fatal("No results are set for the ThingTagRepositoryMock.Add")
|
|
|
+ }
|
|
|
+ return (*mm_results).err
|
|
|
+ }
|
|
|
+ if mmAdd.funcAdd != nil {
|
|
|
+ return mmAdd.funcAdd(ctx, req, tx)
|
|
|
+ }
|
|
|
+ mmAdd.t.Fatalf("Unexpected call to ThingTagRepositoryMock.Add. %v %v %v", ctx, req, tx)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// AddAfterCounter returns a count of finished ThingTagRepositoryMock.Add invocations
|
|
|
+func (mmAdd *ThingTagRepositoryMock) AddAfterCounter() uint64 {
|
|
|
+ return mm_atomic.LoadUint64(&mmAdd.afterAddCounter)
|
|
|
+}
|
|
|
+
|
|
|
+// AddBeforeCounter returns a count of ThingTagRepositoryMock.Add invocations
|
|
|
+func (mmAdd *ThingTagRepositoryMock) AddBeforeCounter() uint64 {
|
|
|
+ return mm_atomic.LoadUint64(&mmAdd.beforeAddCounter)
|
|
|
+}
|
|
|
+
|
|
|
+// Calls returns a list of arguments used in each call to ThingTagRepositoryMock.Add.
|
|
|
+// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
+func (mmAdd *mThingTagRepositoryMockAdd) Calls() []*ThingTagRepositoryMockAddParams {
|
|
|
+ mmAdd.mutex.RLock()
|
|
|
+
|
|
|
+ argCopy := make([]*ThingTagRepositoryMockAddParams, len(mmAdd.callArgs))
|
|
|
+ copy(argCopy, mmAdd.callArgs)
|
|
|
+
|
|
|
+ mmAdd.mutex.RUnlock()
|
|
|
+
|
|
|
+ return argCopy
|
|
|
+}
|
|
|
+
|
|
|
+// MinimockAddDone returns true if the count of the Add invocations corresponds
|
|
|
+// the number of defined expectations
|
|
|
+func (m *ThingTagRepositoryMock) MinimockAddDone() bool {
|
|
|
+ if m.AddMock.optional {
|
|
|
+ // Optional methods provide '0 or more' call count restriction.
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, e := range m.AddMock.expectations {
|
|
|
+ if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return m.AddMock.invocationsDone()
|
|
|
+}
|
|
|
+
|
|
|
+// MinimockAddInspect logs each unmet expectation
|
|
|
+func (m *ThingTagRepositoryMock) MinimockAddInspect() {
|
|
|
+ for _, e := range m.AddMock.expectations {
|
|
|
+ if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
+ m.t.Errorf("Expected call to ThingTagRepositoryMock.Add with params: %#v", *e.params)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ afterAddCounter := mm_atomic.LoadUint64(&m.afterAddCounter)
|
|
|
+ // if default expectation was set then invocations count should be greater than zero
|
|
|
+ if m.AddMock.defaultExpectation != nil && afterAddCounter < 1 {
|
|
|
+ if m.AddMock.defaultExpectation.params == nil {
|
|
|
+ m.t.Error("Expected call to ThingTagRepositoryMock.Add")
|
|
|
+ } else {
|
|
|
+ m.t.Errorf("Expected call to ThingTagRepositoryMock.Add with params: %#v", *m.AddMock.defaultExpectation.params)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // if func was set then invocations count should be greater than zero
|
|
|
+ if m.funcAdd != nil && afterAddCounter < 1 {
|
|
|
+ m.t.Error("Expected call to ThingTagRepositoryMock.Add")
|
|
|
+ }
|
|
|
+
|
|
|
+ if !m.AddMock.invocationsDone() && afterAddCounter > 0 {
|
|
|
+ m.t.Errorf("Expected %d calls to ThingTagRepositoryMock.Add but found %d calls",
|
|
|
+ mm_atomic.LoadUint64(&m.AddMock.expectedInvocations), afterAddCounter)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+type mThingTagRepositoryMockDelete struct {
|
|
|
+ optional bool
|
|
|
+ mock *ThingTagRepositoryMock
|
|
|
+ defaultExpectation *ThingTagRepositoryMockDeleteExpectation
|
|
|
+ expectations []*ThingTagRepositoryMockDeleteExpectation
|
|
|
+
|
|
|
+ callArgs []*ThingTagRepositoryMockDeleteParams
|
|
|
+ mutex sync.RWMutex
|
|
|
+
|
|
|
+ expectedInvocations uint64
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockDeleteExpectation specifies expectation struct of the ThingTagRepository.Delete
|
|
|
+type ThingTagRepositoryMockDeleteExpectation struct {
|
|
|
+ mock *ThingTagRepositoryMock
|
|
|
+ params *ThingTagRepositoryMockDeleteParams
|
|
|
+ paramPtrs *ThingTagRepositoryMockDeleteParamPtrs
|
|
|
+ results *ThingTagRepositoryMockDeleteResults
|
|
|
+ Counter uint64
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockDeleteParams contains parameters of the ThingTagRepository.Delete
|
|
|
+type ThingTagRepositoryMockDeleteParams struct {
|
|
|
+ ctx context.Context
|
|
|
+ req models.DeleteThingTagRequest
|
|
|
+ tx *sql.Tx
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockDeleteParamPtrs contains pointers to parameters of the ThingTagRepository.Delete
|
|
|
+type ThingTagRepositoryMockDeleteParamPtrs struct {
|
|
|
+ ctx *context.Context
|
|
|
+ req *models.DeleteThingTagRequest
|
|
|
+ tx **sql.Tx
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockDeleteResults contains results of the ThingTagRepository.Delete
|
|
|
+type ThingTagRepositoryMockDeleteResults struct {
|
|
|
+ err error
|
|
|
+}
|
|
|
+
|
|
|
+// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
|
|
|
+// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
|
|
|
+// Optional() makes method check to work in '0 or more' mode.
|
|
|
+// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
|
|
|
+// catch the problems when the expected method call is totally skipped during test run.
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) Optional() *mThingTagRepositoryMockDelete {
|
|
|
+ mmDelete.optional = true
|
|
|
+ return mmDelete
|
|
|
+}
|
|
|
+
|
|
|
+// Expect sets up expected params for ThingTagRepository.Delete
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) Expect(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx) *mThingTagRepositoryMockDelete {
|
|
|
+ if mmDelete.mock.funcDelete != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation == nil {
|
|
|
+ mmDelete.defaultExpectation = &ThingTagRepositoryMockDeleteExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation.paramPtrs != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by ExpectParams functions")
|
|
|
+ }
|
|
|
+
|
|
|
+ mmDelete.defaultExpectation.params = &ThingTagRepositoryMockDeleteParams{ctx, req, tx}
|
|
|
+ for _, e := range mmDelete.expectations {
|
|
|
+ if minimock.Equal(e.params, mmDelete.defaultExpectation.params) {
|
|
|
+ mmDelete.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDelete.defaultExpectation.params)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return mmDelete
|
|
|
+}
|
|
|
+
|
|
|
+// ExpectCtxParam1 sets up expected param ctx for ThingTagRepository.Delete
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) ExpectCtxParam1(ctx context.Context) *mThingTagRepositoryMockDelete {
|
|
|
+ if mmDelete.mock.funcDelete != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation == nil {
|
|
|
+ mmDelete.defaultExpectation = &ThingTagRepositoryMockDeleteExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation.params != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmDelete.defaultExpectation.paramPtrs = &ThingTagRepositoryMockDeleteParamPtrs{}
|
|
|
+ }
|
|
|
+ mmDelete.defaultExpectation.paramPtrs.ctx = &ctx
|
|
|
+
|
|
|
+ return mmDelete
|
|
|
+}
|
|
|
+
|
|
|
+// ExpectReqParam2 sets up expected param req for ThingTagRepository.Delete
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) ExpectReqParam2(req models.DeleteThingTagRequest) *mThingTagRepositoryMockDelete {
|
|
|
+ if mmDelete.mock.funcDelete != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation == nil {
|
|
|
+ mmDelete.defaultExpectation = &ThingTagRepositoryMockDeleteExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation.params != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmDelete.defaultExpectation.paramPtrs = &ThingTagRepositoryMockDeleteParamPtrs{}
|
|
|
+ }
|
|
|
+ mmDelete.defaultExpectation.paramPtrs.req = &req
|
|
|
+
|
|
|
+ return mmDelete
|
|
|
+}
|
|
|
+
|
|
|
+// ExpectTxParam3 sets up expected param tx for ThingTagRepository.Delete
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) ExpectTxParam3(tx *sql.Tx) *mThingTagRepositoryMockDelete {
|
|
|
+ if mmDelete.mock.funcDelete != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation == nil {
|
|
|
+ mmDelete.defaultExpectation = &ThingTagRepositoryMockDeleteExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation.params != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmDelete.defaultExpectation.paramPtrs = &ThingTagRepositoryMockDeleteParamPtrs{}
|
|
|
+ }
|
|
|
+ mmDelete.defaultExpectation.paramPtrs.tx = &tx
|
|
|
+
|
|
|
+ return mmDelete
|
|
|
+}
|
|
|
+
|
|
|
+// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.Delete
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) Inspect(f func(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx)) *mThingTagRepositoryMockDelete {
|
|
|
+ if mmDelete.mock.inspectFuncDelete != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.Delete")
|
|
|
+ }
|
|
|
+
|
|
|
+ mmDelete.mock.inspectFuncDelete = f
|
|
|
+
|
|
|
+ return mmDelete
|
|
|
+}
|
|
|
+
|
|
|
+// Return sets up results that will be returned by ThingTagRepository.Delete
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) Return(err error) *ThingTagRepositoryMock {
|
|
|
+ if mmDelete.mock.funcDelete != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.defaultExpectation == nil {
|
|
|
+ mmDelete.defaultExpectation = &ThingTagRepositoryMockDeleteExpectation{mock: mmDelete.mock}
|
|
|
+ }
|
|
|
+ mmDelete.defaultExpectation.results = &ThingTagRepositoryMockDeleteResults{err}
|
|
|
+ return mmDelete.mock
|
|
|
+}
|
|
|
+
|
|
|
+// Set uses given function f to mock the ThingTagRepository.Delete method
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) Set(f func(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx) (err error)) *ThingTagRepositoryMock {
|
|
|
+ if mmDelete.defaultExpectation != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.Delete method")
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(mmDelete.expectations) > 0 {
|
|
|
+ mmDelete.mock.t.Fatalf("Some expectations are already set for the ThingTagRepository.Delete method")
|
|
|
+ }
|
|
|
+
|
|
|
+ mmDelete.mock.funcDelete = f
|
|
|
+ return mmDelete.mock
|
|
|
+}
|
|
|
+
|
|
|
+// When sets expectation for the ThingTagRepository.Delete which will trigger the result defined by the following
|
|
|
+// Then helper
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) When(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx) *ThingTagRepositoryMockDeleteExpectation {
|
|
|
+ if mmDelete.mock.funcDelete != nil {
|
|
|
+ mmDelete.mock.t.Fatalf("ThingTagRepositoryMock.Delete mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ expectation := &ThingTagRepositoryMockDeleteExpectation{
|
|
|
+ mock: mmDelete.mock,
|
|
|
+ params: &ThingTagRepositoryMockDeleteParams{ctx, req, tx},
|
|
|
+ }
|
|
|
+ mmDelete.expectations = append(mmDelete.expectations, expectation)
|
|
|
+ return expectation
|
|
|
+}
|
|
|
+
|
|
|
+// Then sets up ThingTagRepository.Delete return parameters for the expectation previously defined by the When method
|
|
|
+func (e *ThingTagRepositoryMockDeleteExpectation) Then(err error) *ThingTagRepositoryMock {
|
|
|
+ e.results = &ThingTagRepositoryMockDeleteResults{err}
|
|
|
+ return e.mock
|
|
|
+}
|
|
|
+
|
|
|
+// Times sets number of times ThingTagRepository.Delete should be invoked
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) Times(n uint64) *mThingTagRepositoryMockDelete {
|
|
|
+ if n == 0 {
|
|
|
+ mmDelete.mock.t.Fatalf("Times of ThingTagRepositoryMock.Delete mock can not be zero")
|
|
|
+ }
|
|
|
+ mm_atomic.StoreUint64(&mmDelete.expectedInvocations, n)
|
|
|
+ return mmDelete
|
|
|
+}
|
|
|
+
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) invocationsDone() bool {
|
|
|
+ if len(mmDelete.expectations) == 0 && mmDelete.defaultExpectation == nil && mmDelete.mock.funcDelete == nil {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ totalInvocations := mm_atomic.LoadUint64(&mmDelete.mock.afterDeleteCounter)
|
|
|
+ expectedInvocations := mm_atomic.LoadUint64(&mmDelete.expectedInvocations)
|
|
|
+
|
|
|
+ return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
|
|
|
+}
|
|
|
+
|
|
|
+// Delete implements tag.ThingTagRepository
|
|
|
+func (mmDelete *ThingTagRepositoryMock) Delete(ctx context.Context, req models.DeleteThingTagRequest, tx *sql.Tx) (err error) {
|
|
|
+ mm_atomic.AddUint64(&mmDelete.beforeDeleteCounter, 1)
|
|
|
+ defer mm_atomic.AddUint64(&mmDelete.afterDeleteCounter, 1)
|
|
|
+
|
|
|
+ if mmDelete.inspectFuncDelete != nil {
|
|
|
+ mmDelete.inspectFuncDelete(ctx, req, tx)
|
|
|
+ }
|
|
|
+
|
|
|
+ mm_params := ThingTagRepositoryMockDeleteParams{ctx, req, tx}
|
|
|
+
|
|
|
+ // Record call args
|
|
|
+ mmDelete.DeleteMock.mutex.Lock()
|
|
|
+ mmDelete.DeleteMock.callArgs = append(mmDelete.DeleteMock.callArgs, &mm_params)
|
|
|
+ mmDelete.DeleteMock.mutex.Unlock()
|
|
|
+
|
|
|
+ for _, e := range mmDelete.DeleteMock.expectations {
|
|
|
+ if minimock.Equal(*e.params, mm_params) {
|
|
|
+ mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
+ return e.results.err
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDelete.DeleteMock.defaultExpectation != nil {
|
|
|
+ mm_atomic.AddUint64(&mmDelete.DeleteMock.defaultExpectation.Counter, 1)
|
|
|
+ mm_want := mmDelete.DeleteMock.defaultExpectation.params
|
|
|
+ mm_want_ptrs := mmDelete.DeleteMock.defaultExpectation.paramPtrs
|
|
|
+
|
|
|
+ mm_got := ThingTagRepositoryMockDeleteParams{ctx, req, tx}
|
|
|
+
|
|
|
+ if mm_want_ptrs != nil {
|
|
|
+
|
|
|
+ if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
|
|
|
+ mmDelete.t.Errorf("ThingTagRepositoryMock.Delete got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
|
|
|
+ }
|
|
|
+
|
|
|
+ if mm_want_ptrs.req != nil && !minimock.Equal(*mm_want_ptrs.req, mm_got.req) {
|
|
|
+ mmDelete.t.Errorf("ThingTagRepositoryMock.Delete got unexpected parameter req, want: %#v, got: %#v%s\n", *mm_want_ptrs.req, mm_got.req, minimock.Diff(*mm_want_ptrs.req, mm_got.req))
|
|
|
+ }
|
|
|
+
|
|
|
+ if mm_want_ptrs.tx != nil && !minimock.Equal(*mm_want_ptrs.tx, mm_got.tx) {
|
|
|
+ mmDelete.t.Errorf("ThingTagRepositoryMock.Delete got unexpected parameter tx, want: %#v, got: %#v%s\n", *mm_want_ptrs.tx, mm_got.tx, minimock.Diff(*mm_want_ptrs.tx, mm_got.tx))
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
+ mmDelete.t.Errorf("ThingTagRepositoryMock.Delete got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
+ }
|
|
|
+
|
|
|
+ mm_results := mmDelete.DeleteMock.defaultExpectation.results
|
|
|
+ if mm_results == nil {
|
|
|
+ mmDelete.t.Fatal("No results are set for the ThingTagRepositoryMock.Delete")
|
|
|
+ }
|
|
|
+ return (*mm_results).err
|
|
|
+ }
|
|
|
+ if mmDelete.funcDelete != nil {
|
|
|
+ return mmDelete.funcDelete(ctx, req, tx)
|
|
|
+ }
|
|
|
+ mmDelete.t.Fatalf("Unexpected call to ThingTagRepositoryMock.Delete. %v %v %v", ctx, req, tx)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// DeleteAfterCounter returns a count of finished ThingTagRepositoryMock.Delete invocations
|
|
|
+func (mmDelete *ThingTagRepositoryMock) DeleteAfterCounter() uint64 {
|
|
|
+ return mm_atomic.LoadUint64(&mmDelete.afterDeleteCounter)
|
|
|
+}
|
|
|
+
|
|
|
+// DeleteBeforeCounter returns a count of ThingTagRepositoryMock.Delete invocations
|
|
|
+func (mmDelete *ThingTagRepositoryMock) DeleteBeforeCounter() uint64 {
|
|
|
+ return mm_atomic.LoadUint64(&mmDelete.beforeDeleteCounter)
|
|
|
+}
|
|
|
+
|
|
|
+// Calls returns a list of arguments used in each call to ThingTagRepositoryMock.Delete.
|
|
|
+// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
+func (mmDelete *mThingTagRepositoryMockDelete) Calls() []*ThingTagRepositoryMockDeleteParams {
|
|
|
+ mmDelete.mutex.RLock()
|
|
|
+
|
|
|
+ argCopy := make([]*ThingTagRepositoryMockDeleteParams, len(mmDelete.callArgs))
|
|
|
+ copy(argCopy, mmDelete.callArgs)
|
|
|
+
|
|
|
+ mmDelete.mutex.RUnlock()
|
|
|
+
|
|
|
+ return argCopy
|
|
|
+}
|
|
|
+
|
|
|
+// MinimockDeleteDone returns true if the count of the Delete invocations corresponds
|
|
|
+// the number of defined expectations
|
|
|
+func (m *ThingTagRepositoryMock) MinimockDeleteDone() bool {
|
|
|
+ if m.DeleteMock.optional {
|
|
|
+ // Optional methods provide '0 or more' call count restriction.
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, e := range m.DeleteMock.expectations {
|
|
|
+ if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return m.DeleteMock.invocationsDone()
|
|
|
+}
|
|
|
+
|
|
|
+// MinimockDeleteInspect logs each unmet expectation
|
|
|
+func (m *ThingTagRepositoryMock) MinimockDeleteInspect() {
|
|
|
+ for _, e := range m.DeleteMock.expectations {
|
|
|
+ if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
+ m.t.Errorf("Expected call to ThingTagRepositoryMock.Delete with params: %#v", *e.params)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ afterDeleteCounter := mm_atomic.LoadUint64(&m.afterDeleteCounter)
|
|
|
+ // if default expectation was set then invocations count should be greater than zero
|
|
|
+ if m.DeleteMock.defaultExpectation != nil && afterDeleteCounter < 1 {
|
|
|
+ if m.DeleteMock.defaultExpectation.params == nil {
|
|
|
+ m.t.Error("Expected call to ThingTagRepositoryMock.Delete")
|
|
|
+ } else {
|
|
|
+ m.t.Errorf("Expected call to ThingTagRepositoryMock.Delete with params: %#v", *m.DeleteMock.defaultExpectation.params)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // if func was set then invocations count should be greater than zero
|
|
|
+ if m.funcDelete != nil && afterDeleteCounter < 1 {
|
|
|
+ m.t.Error("Expected call to ThingTagRepositoryMock.Delete")
|
|
|
+ }
|
|
|
+
|
|
|
+ if !m.DeleteMock.invocationsDone() && afterDeleteCounter > 0 {
|
|
|
+ m.t.Errorf("Expected %d calls to ThingTagRepositoryMock.Delete but found %d calls",
|
|
|
+ mm_atomic.LoadUint64(&m.DeleteMock.expectedInvocations), afterDeleteCounter)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+type mThingTagRepositoryMockDeleteByTagID struct {
|
|
|
+ optional bool
|
|
|
+ mock *ThingTagRepositoryMock
|
|
|
+ defaultExpectation *ThingTagRepositoryMockDeleteByTagIDExpectation
|
|
|
+ expectations []*ThingTagRepositoryMockDeleteByTagIDExpectation
|
|
|
+
|
|
|
+ callArgs []*ThingTagRepositoryMockDeleteByTagIDParams
|
|
|
+ mutex sync.RWMutex
|
|
|
+
|
|
|
+ expectedInvocations uint64
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockDeleteByTagIDExpectation specifies expectation struct of the ThingTagRepository.DeleteByTagID
|
|
|
+type ThingTagRepositoryMockDeleteByTagIDExpectation struct {
|
|
|
+ mock *ThingTagRepositoryMock
|
|
|
+ params *ThingTagRepositoryMockDeleteByTagIDParams
|
|
|
+ paramPtrs *ThingTagRepositoryMockDeleteByTagIDParamPtrs
|
|
|
+ results *ThingTagRepositoryMockDeleteByTagIDResults
|
|
|
+ Counter uint64
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockDeleteByTagIDParams contains parameters of the ThingTagRepository.DeleteByTagID
|
|
|
+type ThingTagRepositoryMockDeleteByTagIDParams struct {
|
|
|
+ ctx context.Context
|
|
|
+ tagID int
|
|
|
+ tx *sql.Tx
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockDeleteByTagIDParamPtrs contains pointers to parameters of the ThingTagRepository.DeleteByTagID
|
|
|
+type ThingTagRepositoryMockDeleteByTagIDParamPtrs struct {
|
|
|
+ ctx *context.Context
|
|
|
+ tagID *int
|
|
|
+ tx **sql.Tx
|
|
|
+}
|
|
|
+
|
|
|
+// ThingTagRepositoryMockDeleteByTagIDResults contains results of the ThingTagRepository.DeleteByTagID
|
|
|
+type ThingTagRepositoryMockDeleteByTagIDResults struct {
|
|
|
+ err error
|
|
|
+}
|
|
|
+
|
|
|
+// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
|
|
|
+// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
|
|
|
+// Optional() makes method check to work in '0 or more' mode.
|
|
|
+// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
|
|
|
+// catch the problems when the expected method call is totally skipped during test run.
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Optional() *mThingTagRepositoryMockDeleteByTagID {
|
|
|
+ mmDeleteByTagID.optional = true
|
|
|
+ return mmDeleteByTagID
|
|
|
+}
|
|
|
+
|
|
|
+// Expect sets up expected params for ThingTagRepository.DeleteByTagID
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Expect(ctx context.Context, tagID int, tx *sql.Tx) *mThingTagRepositoryMockDeleteByTagID {
|
|
|
+ if mmDeleteByTagID.mock.funcDeleteByTagID != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation == nil {
|
|
|
+ mmDeleteByTagID.defaultExpectation = &ThingTagRepositoryMockDeleteByTagIDExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation.paramPtrs != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by ExpectParams functions")
|
|
|
+ }
|
|
|
+
|
|
|
+ mmDeleteByTagID.defaultExpectation.params = &ThingTagRepositoryMockDeleteByTagIDParams{ctx, tagID, tx}
|
|
|
+ for _, e := range mmDeleteByTagID.expectations {
|
|
|
+ if minimock.Equal(e.params, mmDeleteByTagID.defaultExpectation.params) {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDeleteByTagID.defaultExpectation.params)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return mmDeleteByTagID
|
|
|
+}
|
|
|
+
|
|
|
+// ExpectCtxParam1 sets up expected param ctx for ThingTagRepository.DeleteByTagID
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) ExpectCtxParam1(ctx context.Context) *mThingTagRepositoryMockDeleteByTagID {
|
|
|
+ if mmDeleteByTagID.mock.funcDeleteByTagID != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation == nil {
|
|
|
+ mmDeleteByTagID.defaultExpectation = &ThingTagRepositoryMockDeleteByTagIDExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation.params != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmDeleteByTagID.defaultExpectation.paramPtrs = &ThingTagRepositoryMockDeleteByTagIDParamPtrs{}
|
|
|
+ }
|
|
|
+ mmDeleteByTagID.defaultExpectation.paramPtrs.ctx = &ctx
|
|
|
+
|
|
|
+ return mmDeleteByTagID
|
|
|
+}
|
|
|
+
|
|
|
+// ExpectTagIDParam2 sets up expected param tagID for ThingTagRepository.DeleteByTagID
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) ExpectTagIDParam2(tagID int) *mThingTagRepositoryMockDeleteByTagID {
|
|
|
+ if mmDeleteByTagID.mock.funcDeleteByTagID != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation == nil {
|
|
|
+ mmDeleteByTagID.defaultExpectation = &ThingTagRepositoryMockDeleteByTagIDExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation.params != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmDeleteByTagID.defaultExpectation.paramPtrs = &ThingTagRepositoryMockDeleteByTagIDParamPtrs{}
|
|
|
+ }
|
|
|
+ mmDeleteByTagID.defaultExpectation.paramPtrs.tagID = &tagID
|
|
|
+
|
|
|
+ return mmDeleteByTagID
|
|
|
+}
|
|
|
+
|
|
|
+// ExpectTxParam3 sets up expected param tx for ThingTagRepository.DeleteByTagID
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) ExpectTxParam3(tx *sql.Tx) *mThingTagRepositoryMockDeleteByTagID {
|
|
|
+ if mmDeleteByTagID.mock.funcDeleteByTagID != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation == nil {
|
|
|
+ mmDeleteByTagID.defaultExpectation = &ThingTagRepositoryMockDeleteByTagIDExpectation{}
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation.params != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Expect")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation.paramPtrs == nil {
|
|
|
+ mmDeleteByTagID.defaultExpectation.paramPtrs = &ThingTagRepositoryMockDeleteByTagIDParamPtrs{}
|
|
|
+ }
|
|
|
+ mmDeleteByTagID.defaultExpectation.paramPtrs.tx = &tx
|
|
|
+
|
|
|
+ return mmDeleteByTagID
|
|
|
+}
|
|
|
+
|
|
|
+// Inspect accepts an inspector function that has same arguments as the ThingTagRepository.DeleteByTagID
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Inspect(f func(ctx context.Context, tagID int, tx *sql.Tx)) *mThingTagRepositoryMockDeleteByTagID {
|
|
|
+ if mmDeleteByTagID.mock.inspectFuncDeleteByTagID != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("Inspect function is already set for ThingTagRepositoryMock.DeleteByTagID")
|
|
|
+ }
|
|
|
+
|
|
|
+ mmDeleteByTagID.mock.inspectFuncDeleteByTagID = f
|
|
|
+
|
|
|
+ return mmDeleteByTagID
|
|
|
+}
|
|
|
+
|
|
|
+// Return sets up results that will be returned by ThingTagRepository.DeleteByTagID
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Return(err error) *ThingTagRepositoryMock {
|
|
|
+ if mmDeleteByTagID.mock.funcDeleteByTagID != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.defaultExpectation == nil {
|
|
|
+ mmDeleteByTagID.defaultExpectation = &ThingTagRepositoryMockDeleteByTagIDExpectation{mock: mmDeleteByTagID.mock}
|
|
|
+ }
|
|
|
+ mmDeleteByTagID.defaultExpectation.results = &ThingTagRepositoryMockDeleteByTagIDResults{err}
|
|
|
+ return mmDeleteByTagID.mock
|
|
|
+}
|
|
|
+
|
|
|
+// Set uses given function f to mock the ThingTagRepository.DeleteByTagID method
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Set(f func(ctx context.Context, tagID int, tx *sql.Tx) (err error)) *ThingTagRepositoryMock {
|
|
|
+ if mmDeleteByTagID.defaultExpectation != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("Default expectation is already set for the ThingTagRepository.DeleteByTagID method")
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(mmDeleteByTagID.expectations) > 0 {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("Some expectations are already set for the ThingTagRepository.DeleteByTagID method")
|
|
|
+ }
|
|
|
+
|
|
|
+ mmDeleteByTagID.mock.funcDeleteByTagID = f
|
|
|
+ return mmDeleteByTagID.mock
|
|
|
+}
|
|
|
+
|
|
|
+// When sets expectation for the ThingTagRepository.DeleteByTagID which will trigger the result defined by the following
|
|
|
+// Then helper
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) When(ctx context.Context, tagID int, tx *sql.Tx) *ThingTagRepositoryMockDeleteByTagIDExpectation {
|
|
|
+ if mmDeleteByTagID.mock.funcDeleteByTagID != nil {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("ThingTagRepositoryMock.DeleteByTagID mock is already set by Set")
|
|
|
+ }
|
|
|
+
|
|
|
+ expectation := &ThingTagRepositoryMockDeleteByTagIDExpectation{
|
|
|
+ mock: mmDeleteByTagID.mock,
|
|
|
+ params: &ThingTagRepositoryMockDeleteByTagIDParams{ctx, tagID, tx},
|
|
|
+ }
|
|
|
+ mmDeleteByTagID.expectations = append(mmDeleteByTagID.expectations, expectation)
|
|
|
+ return expectation
|
|
|
+}
|
|
|
+
|
|
|
+// Then sets up ThingTagRepository.DeleteByTagID return parameters for the expectation previously defined by the When method
|
|
|
+func (e *ThingTagRepositoryMockDeleteByTagIDExpectation) Then(err error) *ThingTagRepositoryMock {
|
|
|
+ e.results = &ThingTagRepositoryMockDeleteByTagIDResults{err}
|
|
|
+ return e.mock
|
|
|
+}
|
|
|
+
|
|
|
+// Times sets number of times ThingTagRepository.DeleteByTagID should be invoked
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Times(n uint64) *mThingTagRepositoryMockDeleteByTagID {
|
|
|
+ if n == 0 {
|
|
|
+ mmDeleteByTagID.mock.t.Fatalf("Times of ThingTagRepositoryMock.DeleteByTagID mock can not be zero")
|
|
|
+ }
|
|
|
+ mm_atomic.StoreUint64(&mmDeleteByTagID.expectedInvocations, n)
|
|
|
+ return mmDeleteByTagID
|
|
|
+}
|
|
|
+
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) invocationsDone() bool {
|
|
|
+ if len(mmDeleteByTagID.expectations) == 0 && mmDeleteByTagID.defaultExpectation == nil && mmDeleteByTagID.mock.funcDeleteByTagID == nil {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ totalInvocations := mm_atomic.LoadUint64(&mmDeleteByTagID.mock.afterDeleteByTagIDCounter)
|
|
|
+ expectedInvocations := mm_atomic.LoadUint64(&mmDeleteByTagID.expectedInvocations)
|
|
|
+
|
|
|
+ return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
|
|
|
+}
|
|
|
+
|
|
|
+// DeleteByTagID implements tag.ThingTagRepository
|
|
|
+func (mmDeleteByTagID *ThingTagRepositoryMock) DeleteByTagID(ctx context.Context, tagID int, tx *sql.Tx) (err error) {
|
|
|
+ mm_atomic.AddUint64(&mmDeleteByTagID.beforeDeleteByTagIDCounter, 1)
|
|
|
+ defer mm_atomic.AddUint64(&mmDeleteByTagID.afterDeleteByTagIDCounter, 1)
|
|
|
+
|
|
|
+ if mmDeleteByTagID.inspectFuncDeleteByTagID != nil {
|
|
|
+ mmDeleteByTagID.inspectFuncDeleteByTagID(ctx, tagID, tx)
|
|
|
+ }
|
|
|
+
|
|
|
+ mm_params := ThingTagRepositoryMockDeleteByTagIDParams{ctx, tagID, tx}
|
|
|
+
|
|
|
+ // Record call args
|
|
|
+ mmDeleteByTagID.DeleteByTagIDMock.mutex.Lock()
|
|
|
+ mmDeleteByTagID.DeleteByTagIDMock.callArgs = append(mmDeleteByTagID.DeleteByTagIDMock.callArgs, &mm_params)
|
|
|
+ mmDeleteByTagID.DeleteByTagIDMock.mutex.Unlock()
|
|
|
+
|
|
|
+ for _, e := range mmDeleteByTagID.DeleteByTagIDMock.expectations {
|
|
|
+ if minimock.Equal(*e.params, mm_params) {
|
|
|
+ mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
+ return e.results.err
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if mmDeleteByTagID.DeleteByTagIDMock.defaultExpectation != nil {
|
|
|
+ mm_atomic.AddUint64(&mmDeleteByTagID.DeleteByTagIDMock.defaultExpectation.Counter, 1)
|
|
|
+ mm_want := mmDeleteByTagID.DeleteByTagIDMock.defaultExpectation.params
|
|
|
+ mm_want_ptrs := mmDeleteByTagID.DeleteByTagIDMock.defaultExpectation.paramPtrs
|
|
|
+
|
|
|
+ mm_got := ThingTagRepositoryMockDeleteByTagIDParams{ctx, tagID, tx}
|
|
|
+
|
|
|
+ if mm_want_ptrs != nil {
|
|
|
+
|
|
|
+ if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
|
|
|
+ mmDeleteByTagID.t.Errorf("ThingTagRepositoryMock.DeleteByTagID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
|
|
|
+ }
|
|
|
+
|
|
|
+ if mm_want_ptrs.tagID != nil && !minimock.Equal(*mm_want_ptrs.tagID, mm_got.tagID) {
|
|
|
+ mmDeleteByTagID.t.Errorf("ThingTagRepositoryMock.DeleteByTagID got unexpected parameter tagID, want: %#v, got: %#v%s\n", *mm_want_ptrs.tagID, mm_got.tagID, minimock.Diff(*mm_want_ptrs.tagID, mm_got.tagID))
|
|
|
+ }
|
|
|
+
|
|
|
+ if mm_want_ptrs.tx != nil && !minimock.Equal(*mm_want_ptrs.tx, mm_got.tx) {
|
|
|
+ mmDeleteByTagID.t.Errorf("ThingTagRepositoryMock.DeleteByTagID got unexpected parameter tx, want: %#v, got: %#v%s\n", *mm_want_ptrs.tx, mm_got.tx, minimock.Diff(*mm_want_ptrs.tx, mm_got.tx))
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
+ mmDeleteByTagID.t.Errorf("ThingTagRepositoryMock.DeleteByTagID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
+ }
|
|
|
+
|
|
|
+ mm_results := mmDeleteByTagID.DeleteByTagIDMock.defaultExpectation.results
|
|
|
+ if mm_results == nil {
|
|
|
+ mmDeleteByTagID.t.Fatal("No results are set for the ThingTagRepositoryMock.DeleteByTagID")
|
|
|
+ }
|
|
|
+ return (*mm_results).err
|
|
|
+ }
|
|
|
+ if mmDeleteByTagID.funcDeleteByTagID != nil {
|
|
|
+ return mmDeleteByTagID.funcDeleteByTagID(ctx, tagID, tx)
|
|
|
+ }
|
|
|
+ mmDeleteByTagID.t.Fatalf("Unexpected call to ThingTagRepositoryMock.DeleteByTagID. %v %v %v", ctx, tagID, tx)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// DeleteByTagIDAfterCounter returns a count of finished ThingTagRepositoryMock.DeleteByTagID invocations
|
|
|
+func (mmDeleteByTagID *ThingTagRepositoryMock) DeleteByTagIDAfterCounter() uint64 {
|
|
|
+ return mm_atomic.LoadUint64(&mmDeleteByTagID.afterDeleteByTagIDCounter)
|
|
|
+}
|
|
|
+
|
|
|
+// DeleteByTagIDBeforeCounter returns a count of ThingTagRepositoryMock.DeleteByTagID invocations
|
|
|
+func (mmDeleteByTagID *ThingTagRepositoryMock) DeleteByTagIDBeforeCounter() uint64 {
|
|
|
+ return mm_atomic.LoadUint64(&mmDeleteByTagID.beforeDeleteByTagIDCounter)
|
|
|
+}
|
|
|
+
|
|
|
+// Calls returns a list of arguments used in each call to ThingTagRepositoryMock.DeleteByTagID.
|
|
|
+// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
+func (mmDeleteByTagID *mThingTagRepositoryMockDeleteByTagID) Calls() []*ThingTagRepositoryMockDeleteByTagIDParams {
|
|
|
+ mmDeleteByTagID.mutex.RLock()
|
|
|
+
|
|
|
+ argCopy := make([]*ThingTagRepositoryMockDeleteByTagIDParams, len(mmDeleteByTagID.callArgs))
|
|
|
+ copy(argCopy, mmDeleteByTagID.callArgs)
|
|
|
+
|
|
|
+ mmDeleteByTagID.mutex.RUnlock()
|
|
|
+
|
|
|
+ return argCopy
|
|
|
+}
|
|
|
+
|
|
|
+// MinimockDeleteByTagIDDone returns true if the count of the DeleteByTagID invocations corresponds
|
|
|
+// the number of defined expectations
|
|
|
+func (m *ThingTagRepositoryMock) MinimockDeleteByTagIDDone() bool {
|
|
|
+ if m.DeleteByTagIDMock.optional {
|
|
|
+ // Optional methods provide '0 or more' call count restriction.
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, e := range m.DeleteByTagIDMock.expectations {
|
|
|
+ if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return m.DeleteByTagIDMock.invocationsDone()
|
|
|
+}
|
|
|
+
|
|
|
+// MinimockDeleteByTagIDInspect logs each unmet expectation
|
|
|
+func (m *ThingTagRepositoryMock) MinimockDeleteByTagIDInspect() {
|
|
|
+ for _, e := range m.DeleteByTagIDMock.expectations {
|
|
|
+ if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
+ m.t.Errorf("Expected call to ThingTagRepositoryMock.DeleteByTagID with params: %#v", *e.params)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ afterDeleteByTagIDCounter := mm_atomic.LoadUint64(&m.afterDeleteByTagIDCounter)
|
|
|
+ // if default expectation was set then invocations count should be greater than zero
|
|
|
+ if m.DeleteByTagIDMock.defaultExpectation != nil && afterDeleteByTagIDCounter < 1 {
|
|
|
+ if m.DeleteByTagIDMock.defaultExpectation.params == nil {
|
|
|
+ m.t.Error("Expected call to ThingTagRepositoryMock.DeleteByTagID")
|
|
|
+ } else {
|
|
|
+ m.t.Errorf("Expected call to ThingTagRepositoryMock.DeleteByTagID with params: %#v", *m.DeleteByTagIDMock.defaultExpectation.params)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // if func was set then invocations count should be greater than zero
|
|
|
+ if m.funcDeleteByTagID != nil && afterDeleteByTagIDCounter < 1 {
|
|
|
+ m.t.Error("Expected call to ThingTagRepositoryMock.DeleteByTagID")
|
|
|
+ }
|
|
|
+
|
|
|
+ if !m.DeleteByTagIDMock.invocationsDone() && afterDeleteByTagIDCounter > 0 {
|
|
|
+ m.t.Errorf("Expected %d calls to ThingTagRepositoryMock.DeleteByTagID but found %d calls",
|
|
|
+ mm_atomic.LoadUint64(&m.DeleteByTagIDMock.expectedInvocations), afterDeleteByTagIDCounter)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// MinimockFinish checks that all mocked methods have been called the expected number of times
|
|
|
+func (m *ThingTagRepositoryMock) MinimockFinish() {
|
|
|
+ m.finishOnce.Do(func() {
|
|
|
+ if !m.minimockDone() {
|
|
|
+ m.MinimockAddInspect()
|
|
|
+
|
|
|
+ m.MinimockDeleteInspect()
|
|
|
+
|
|
|
+ m.MinimockDeleteByTagIDInspect()
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// MinimockWait waits for all mocked methods to be called the expected number of times
|
|
|
+func (m *ThingTagRepositoryMock) MinimockWait(timeout mm_time.Duration) {
|
|
|
+ timeoutCh := mm_time.After(timeout)
|
|
|
+ for {
|
|
|
+ if m.minimockDone() {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ select {
|
|
|
+ case <-timeoutCh:
|
|
|
+ m.MinimockFinish()
|
|
|
+ return
|
|
|
+ case <-mm_time.After(10 * mm_time.Millisecond):
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (m *ThingTagRepositoryMock) minimockDone() bool {
|
|
|
+ done := true
|
|
|
+ return done &&
|
|
|
+ m.MinimockAddDone() &&
|
|
|
+ m.MinimockDeleteDone() &&
|
|
|
+ m.MinimockDeleteByTagIDDone()
|
|
|
+}
|