github.com/cozy/cozy-stack@v0.0.0-20240603063001-31110fa4cae1/model/settings/storage_mock.go (about) 1 package settings 2 3 import ( 4 "testing" 5 6 "github.com/cozy/cozy-stack/pkg/couchdb" 7 "github.com/cozy/cozy-stack/pkg/prefixer" 8 "github.com/stretchr/testify/mock" 9 ) 10 11 type storageMock struct { 12 mock.Mock 13 } 14 15 func newStorageMock(t *testing.T) *storageMock { 16 m := new(storageMock) 17 m.Test(t) 18 19 t.Cleanup(func() { m.AssertExpectations(t) }) 20 21 return m 22 } 23 24 func (m *storageMock) setInstanceSettings(inst prefixer.Prefixer, doc *couchdb.JSONDoc) error { 25 return m.Called(inst, doc).Error(0) 26 } 27 28 func (m *storageMock) getInstanceSettings(inst prefixer.Prefixer) (*couchdb.JSONDoc, error) { 29 args := m.Called(inst) 30 31 if args.Get(0) == nil { 32 return nil, args.Error(1) 33 } 34 35 return args.Get(0).(*couchdb.JSONDoc), args.Error(1) 36 }