mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-11 02:13:41 +09:00
GO-2691: Fix mock generator, fix profile usage
This commit is contained in:
parent
af4137c42f
commit
3a76908e0d
19 changed files with 230 additions and 1183 deletions
|
@ -46,6 +46,10 @@ packages:
|
|||
github.com/anyproto/anytype-heart/core/subscription:
|
||||
interfaces:
|
||||
CollectionService:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}"
|
||||
outpkg: "{{.PackageName}}"
|
||||
inpackage: true
|
||||
github.com/anyproto/anytype-heart/core/block/object/objectcache:
|
||||
interfaces:
|
||||
Cache:
|
||||
|
|
2
Makefile
2
Makefile
|
@ -73,7 +73,7 @@ test-deps:
|
|||
@go build -o deps go.uber.org/mock/mockgen
|
||||
@go build -o deps github.com/vektra/mockery/v2
|
||||
@go generate ./...
|
||||
@$(DEPS_PATH)/mockery --disable-version-string --all
|
||||
@$(DEPS_PATH)/mockery --disable-version-string
|
||||
|
||||
clear-test-deps:
|
||||
@echo 'Removing test mocks...'
|
||||
|
|
|
@ -186,51 +186,6 @@ func (_c *MockService_GetInfo_Call) RunAndReturn(run func(context.Context, strin
|
|||
return _c
|
||||
}
|
||||
|
||||
// IdentityObjectId provides a mock function with given fields:
|
||||
func (_m *MockService) ParticipantId(string) string {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for IdentityObjectId")
|
||||
}
|
||||
|
||||
var r0 string
|
||||
if rf, ok := ret.Get(0).(func() string); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockService_IdentityObjectId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IdentityObjectId'
|
||||
type MockService_IdentityObjectId_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// IdentityObjectId is a helper method to define mock.On call
|
||||
func (_e *MockService_Expecter) IdentityObjectId() *MockService_IdentityObjectId_Call {
|
||||
return &MockService_IdentityObjectId_Call{Call: _e.mock.On("IdentityObjectId")}
|
||||
}
|
||||
|
||||
func (_c *MockService_IdentityObjectId_Call) Run(run func()) *MockService_IdentityObjectId_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_IdentityObjectId_Call) Return(_a0 string) *MockService_IdentityObjectId_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_IdentityObjectId_Call) RunAndReturn(run func() string) *MockService_IdentityObjectId_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Init provides a mock function with given fields: a
|
||||
func (_m *MockService) Init(a *app.App) error {
|
||||
ret := _m.Called(a)
|
||||
|
@ -277,57 +232,48 @@ func (_c *MockService_Init_Call) RunAndReturn(run func(*app.App) error) *MockSer
|
|||
return _c
|
||||
}
|
||||
|
||||
// LocalProfile provides a mock function with given fields:
|
||||
func (_m *MockService) LocalProfile() (account.Profile, error) {
|
||||
ret := _m.Called()
|
||||
// MyParticipantId provides a mock function with given fields: _a0
|
||||
func (_m *MockService) MyParticipantId(_a0 string) string {
|
||||
ret := _m.Called(_a0)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for LocalProfile")
|
||||
panic("no return value specified for MyParticipantId")
|
||||
}
|
||||
|
||||
var r0 account.Profile
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func() (account.Profile, error)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() account.Profile); ok {
|
||||
r0 = rf()
|
||||
var r0 string
|
||||
if rf, ok := ret.Get(0).(func(string) string); ok {
|
||||
r0 = rf(_a0)
|
||||
} else {
|
||||
r0 = ret.Get(0).(account.Profile)
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockService_LocalProfile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LocalProfile'
|
||||
type MockService_LocalProfile_Call struct {
|
||||
// MockService_MyParticipantId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MyParticipantId'
|
||||
type MockService_MyParticipantId_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// LocalProfile is a helper method to define mock.On call
|
||||
func (_e *MockService_Expecter) LocalProfile() *MockService_LocalProfile_Call {
|
||||
return &MockService_LocalProfile_Call{Call: _e.mock.On("LocalProfile")}
|
||||
// MyParticipantId is a helper method to define mock.On call
|
||||
// - _a0 string
|
||||
func (_e *MockService_Expecter) MyParticipantId(_a0 interface{}) *MockService_MyParticipantId_Call {
|
||||
return &MockService_MyParticipantId_Call{Call: _e.mock.On("MyParticipantId", _a0)}
|
||||
}
|
||||
|
||||
func (_c *MockService_LocalProfile_Call) Run(run func()) *MockService_LocalProfile_Call {
|
||||
func (_c *MockService_MyParticipantId_Call) Run(run func(_a0 string)) *MockService_MyParticipantId_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
run(args[0].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_LocalProfile_Call) Return(_a0 account.Profile, _a1 error) *MockService_LocalProfile_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
func (_c *MockService_MyParticipantId_Call) Return(_a0 string) *MockService_MyParticipantId_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_LocalProfile_Call) RunAndReturn(run func() (account.Profile, error)) *MockService_LocalProfile_Call {
|
||||
func (_c *MockService_MyParticipantId_Call) RunAndReturn(run func(string) string) *MockService_MyParticipantId_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
@ -422,6 +368,116 @@ func (_c *MockService_PersonalSpaceID_Call) RunAndReturn(run func() string) *Moc
|
|||
return _c
|
||||
}
|
||||
|
||||
// ProfileInfo provides a mock function with given fields:
|
||||
func (_m *MockService) ProfileInfo() (account.Profile, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for ProfileInfo")
|
||||
}
|
||||
|
||||
var r0 account.Profile
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func() (account.Profile, error)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() account.Profile); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(account.Profile)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockService_ProfileInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProfileInfo'
|
||||
type MockService_ProfileInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// ProfileInfo is a helper method to define mock.On call
|
||||
func (_e *MockService_Expecter) ProfileInfo() *MockService_ProfileInfo_Call {
|
||||
return &MockService_ProfileInfo_Call{Call: _e.mock.On("ProfileInfo")}
|
||||
}
|
||||
|
||||
func (_c *MockService_ProfileInfo_Call) Run(run func()) *MockService_ProfileInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_ProfileInfo_Call) Return(_a0 account.Profile, _a1 error) *MockService_ProfileInfo_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_ProfileInfo_Call) RunAndReturn(run func() (account.Profile, error)) *MockService_ProfileInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// ProfileObjectId provides a mock function with given fields:
|
||||
func (_m *MockService) ProfileObjectId() (string, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for ProfileObjectId")
|
||||
}
|
||||
|
||||
var r0 string
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func() (string, error)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() string); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockService_ProfileObjectId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProfileObjectId'
|
||||
type MockService_ProfileObjectId_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// ProfileObjectId is a helper method to define mock.On call
|
||||
func (_e *MockService_Expecter) ProfileObjectId() *MockService_ProfileObjectId_Call {
|
||||
return &MockService_ProfileObjectId_Call{Call: _e.mock.On("ProfileObjectId")}
|
||||
}
|
||||
|
||||
func (_c *MockService_ProfileObjectId_Call) Run(run func()) *MockService_ProfileObjectId_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_ProfileObjectId_Call) Return(_a0 string, _a1 error) *MockService_ProfileObjectId_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_ProfileObjectId_Call) RunAndReturn(run func() (string, error)) *MockService_ProfileObjectId_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// RevertDeletion provides a mock function with given fields: ctx
|
||||
func (_m *MockService) RevertDeletion(ctx context.Context) error {
|
||||
ret := _m.Called(ctx)
|
||||
|
|
|
@ -1,32 +1,40 @@
|
|||
package account
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/anyproto/anytype-heart/core/domain"
|
||||
)
|
||||
|
||||
type Profile struct {
|
||||
Id string
|
||||
AccountAddr string
|
||||
Name string
|
||||
IconImage string
|
||||
IconColor string
|
||||
Id string
|
||||
AccountId string
|
||||
Name string
|
||||
IconImage string
|
||||
IconColor string
|
||||
}
|
||||
|
||||
func (s *service) ParticipantId(spaceId string) string {
|
||||
func (s *service) MyParticipantId(spaceId string) string {
|
||||
return domain.NewParticipantId(spaceId, s.AccountID())
|
||||
}
|
||||
|
||||
func (s *service) LocalProfile() (Profile, error) {
|
||||
// TODO Fix ID!!!
|
||||
profile := Profile{
|
||||
Id: s.ParticipantId("TODO"),
|
||||
AccountAddr: s.wallet.GetAccountPrivkey().GetPublic().Account(),
|
||||
func (s *service) ProfileObjectId() (string, error) {
|
||||
ids, err := s.getDerivedIds(context.Background(), s.personalSpaceId)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return ids.Profile, nil
|
||||
}
|
||||
|
||||
if s.objectStore == nil {
|
||||
return profile, errors.New("objectstore not available")
|
||||
func (s *service) ProfileInfo() (Profile, error) {
|
||||
profileId, err := s.ProfileObjectId()
|
||||
if err != nil {
|
||||
return Profile{}, fmt.Errorf("get profile id: %w", err)
|
||||
}
|
||||
profile := Profile{
|
||||
Id: profileId,
|
||||
AccountId: s.AccountID(),
|
||||
}
|
||||
|
||||
profileDetails, err := s.objectStore.GetDetails(profile.Id)
|
||||
|
|
|
@ -38,8 +38,10 @@ type Service interface {
|
|||
AccountID() string
|
||||
SignData(data []byte) (signature []byte, err error)
|
||||
PersonalSpaceID() string
|
||||
ParticipantId(string) string
|
||||
LocalProfile() (Profile, error)
|
||||
MyParticipantId(string) string
|
||||
// ProfileObjectId returns id of Profile object stored in personal space
|
||||
ProfileObjectId() (string, error)
|
||||
ProfileInfo() (Profile, error)
|
||||
}
|
||||
|
||||
type service struct {
|
||||
|
@ -55,7 +57,7 @@ type service struct {
|
|||
|
||||
picker getblock.ObjectGetter
|
||||
once sync.Once
|
||||
personalSpaceID string
|
||||
personalSpaceId string
|
||||
}
|
||||
|
||||
func New() Service {
|
||||
|
@ -72,7 +74,7 @@ func (s *service) Init(a *app.App) (err error) {
|
|||
s.config = app.MustComponent[*config.Config](a)
|
||||
s.picker = app.MustComponent[getblock.ObjectGetter](a)
|
||||
s.objectStore = app.MustComponent[objectstore.ObjectStore](a)
|
||||
s.personalSpaceID, err = s.spaceCore.DeriveID(context.Background(), spacecore.SpaceType)
|
||||
s.personalSpaceId, err = s.spaceCore.DeriveID(context.Background(), spacecore.SpaceType)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -97,7 +99,7 @@ func (s *service) SignData(data []byte) (signature []byte, err error) {
|
|||
}
|
||||
|
||||
func (s *service) PersonalSpaceID() string {
|
||||
return s.personalSpaceID
|
||||
return s.personalSpaceId
|
||||
}
|
||||
|
||||
func (s *service) Name() (name string) {
|
||||
|
@ -136,7 +138,7 @@ func (s *service) GetInfo(ctx context.Context, spaceID string) (*model.AccountIn
|
|||
return nil, fmt.Errorf("failed to derive tech space id: %w", err)
|
||||
}
|
||||
|
||||
ids, err := s.getIds(ctx, spaceID)
|
||||
ids, err := s.getDerivedIds(ctx, spaceID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get derived ids: %w", err)
|
||||
}
|
||||
|
@ -167,7 +169,7 @@ func (s *service) GetInfo(ctx context.Context, spaceID string) (*model.AccountIn
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (s *service) getIds(ctx context.Context, spaceID string) (ids threads.DerivedSmartblockIds, err error) {
|
||||
func (s *service) getDerivedIds(ctx context.Context, spaceID string) (ids threads.DerivedSmartblockIds, err error) {
|
||||
spc, err := s.spaceService.Get(ctx, spaceID)
|
||||
if err != nil {
|
||||
return ids, fmt.Errorf("failed to get space: %w", err)
|
||||
|
@ -179,7 +181,7 @@ func (s *service) getAnalyticsID(ctx context.Context) (string, error) {
|
|||
if s.config.AnalyticsId != "" {
|
||||
return s.config.AnalyticsId, nil
|
||||
}
|
||||
ids, err := s.getIds(ctx, s.personalSpaceID)
|
||||
ids, err := s.getDerivedIds(ctx, s.personalSpaceId)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to get derived ids: %w", err)
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ var log = logging.Logger("anytype-mw-editor")
|
|||
|
||||
type accountService interface {
|
||||
PersonalSpaceID() string
|
||||
ParticipantId(spaceId string) string
|
||||
MyParticipantId(spaceId string) string
|
||||
}
|
||||
|
||||
type ObjectFactory struct {
|
||||
|
@ -128,7 +128,7 @@ func (f *ObjectFactory) InitObject(space smartblock.Space, id string, initCtx *s
|
|||
func (f *ObjectFactory) produceSmartblock(space smartblock.Space) smartblock.SmartBlock {
|
||||
return smartblock.New(
|
||||
space,
|
||||
f.accountService.ParticipantId(space.Id()),
|
||||
f.accountService.MyParticipantId(space.Id()),
|
||||
f.fileStore,
|
||||
f.restrictionService,
|
||||
f.objectStore,
|
||||
|
|
|
@ -23,7 +23,7 @@ type Widget interface {
|
|||
|
||||
type accountService interface {
|
||||
PersonalSpaceID() string
|
||||
ParticipantId(string) string
|
||||
MyParticipantId(string) string
|
||||
}
|
||||
|
||||
type widget struct {
|
||||
|
@ -76,7 +76,7 @@ func (w *widget) CreateBlock(s *state.State, req *pb.RpcBlockCreateWidgetRequest
|
|||
|
||||
if l, ok := req.Block.GetContent().(*model.BlockContentOfLink); ok {
|
||||
// substitute identity object with profile object as links are treated differently in personal and private spaces
|
||||
if l.Link.TargetBlockId == w.accountService.ParticipantId(w.SpaceID()) && w.Space().Id() == w.accountService.PersonalSpaceID() {
|
||||
if l.Link.TargetBlockId == w.accountService.MyParticipantId(w.SpaceID()) && w.Space().Id() == w.accountService.PersonalSpaceID() {
|
||||
l.Link.TargetBlockId = w.Space().DerivedIDs().Profile
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -496,7 +496,7 @@ func (e *export) createProfileFile(spaceID string, wr writer) error {
|
|||
}
|
||||
var spaceDashBoardID string
|
||||
|
||||
pr, err := e.accountService.LocalProfile()
|
||||
pr, err := e.accountService.ProfileInfo()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ func (e *export) createProfileFile(spaceID string, wr writer) error {
|
|||
}
|
||||
profile := &pb.Profile{
|
||||
SpaceDashboardId: spaceDashBoardID,
|
||||
Address: pr.AccountAddr,
|
||||
Address: pr.AccountId,
|
||||
Name: pr.Name,
|
||||
Avatar: pr.IconImage,
|
||||
ProfileId: pr.Id,
|
||||
|
|
|
@ -149,14 +149,14 @@ func (p *Pb) handleImportPath(
|
|||
}
|
||||
}
|
||||
if profile != nil {
|
||||
pr, e := p.accountService.LocalProfile()
|
||||
pr, e := p.accountService.ProfileInfo()
|
||||
if e != nil {
|
||||
allErrors.Add(e)
|
||||
if allErrors.ShouldAbortImport(pathCount, model.Import_Pb) {
|
||||
return nil, nil, nil
|
||||
}
|
||||
}
|
||||
needToImportWidgets = p.needToImportWidgets(profile.Address, pr.AccountAddr)
|
||||
needToImportWidgets = p.needToImportWidgets(profile.Address, pr.AccountId)
|
||||
profileID = profile.ProfileId
|
||||
}
|
||||
return p.getSnapshotsFromProvidedFiles(pathCount, importSource, allErrors, path, profileID, needToImportWidgets, isMigration, importType)
|
||||
|
@ -339,7 +339,11 @@ func (p *Pb) normalizeSnapshot(snapshot *pb.SnapshotWithType, id string, profile
|
|||
}
|
||||
|
||||
if snapshot.SbType == model.SmartBlockType_ProfilePage {
|
||||
id = p.getIDForUserProfile(snapshot, profileID, id, isMigration)
|
||||
var err error
|
||||
id, err = p.getIDForUserProfile(snapshot, profileID, id, isMigration)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("get user profile id: %w", err)
|
||||
}
|
||||
p.setProfileIconOption(snapshot, profileID)
|
||||
}
|
||||
if snapshot.SbType == model.SmartBlockType_Page {
|
||||
|
@ -348,12 +352,12 @@ func (p *Pb) normalizeSnapshot(snapshot *pb.SnapshotWithType, id string, profile
|
|||
return id, nil
|
||||
}
|
||||
|
||||
func (p *Pb) getIDForUserProfile(mo *pb.SnapshotWithType, profileID string, id string, isMigration bool) string {
|
||||
func (p *Pb) getIDForUserProfile(mo *pb.SnapshotWithType, profileID string, id string, isMigration bool) (string, error) {
|
||||
objectID := pbtypes.GetString(mo.Snapshot.Data.Details, bundle.RelationKeyId.String())
|
||||
if objectID == profileID && isMigration {
|
||||
return p.accountService.ParticipantId("TODO")
|
||||
return p.accountService.ProfileObjectId()
|
||||
}
|
||||
return id
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func (p *Pb) setProfileIconOption(mo *pb.SnapshotWithType, profileID string) {
|
||||
|
|
|
@ -33,7 +33,7 @@ func New() Service {
|
|||
}
|
||||
|
||||
type accountService interface {
|
||||
ParticipantId(string) string
|
||||
MyParticipantId(string) string
|
||||
PersonalSpaceID() string
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ func (s *source) buildState() (doc state.Doc, err error) {
|
|||
// temporary, though the applying change to this Dataview block will persist this migration, breaking backward
|
||||
// compatibility. But in many cases we expect that users update object not so often as they just view them.
|
||||
// TODO: we can skip migration for non-personal spaces
|
||||
migration := NewSubObjectsAndProfileLinksMigration(s.smartblockType, s.space, s.accountService.ParticipantId(s.spaceID), s.accountService.PersonalSpaceID(), s.objectStore)
|
||||
migration := NewSubObjectsAndProfileLinksMigration(s.smartblockType, s.space, s.accountService.MyParticipantId(s.spaceID), s.accountService.PersonalSpaceID(), s.objectStore)
|
||||
migration.Migrate(st)
|
||||
|
||||
if s.Type() == smartblock.SmartBlockTypePage || s.Type() == smartblock.SmartBlockTypeProfilePage {
|
||||
|
|
|
@ -396,58 +396,67 @@ func (_c *MockService_GetFileIdFromObject_Call) RunAndReturn(run func(context.Co
|
|||
return _c
|
||||
}
|
||||
|
||||
// GetObjectIdByFileId provides a mock function with given fields: fileId
|
||||
func (_m *MockService) GetObjectIdByFileId(fileId domain.FileId) (string, error) {
|
||||
// GetObjectDetailsByFileId provides a mock function with given fields: fileId
|
||||
func (_m *MockService) GetObjectDetailsByFileId(fileId domain.FullFileId) (string, *types.Struct, error) {
|
||||
ret := _m.Called(fileId)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetObjectIdByFileId")
|
||||
panic("no return value specified for GetObjectDetailsByFileId")
|
||||
}
|
||||
|
||||
var r0 string
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(domain.FileId) (string, error)); ok {
|
||||
var r1 *types.Struct
|
||||
var r2 error
|
||||
if rf, ok := ret.Get(0).(func(domain.FullFileId) (string, *types.Struct, error)); ok {
|
||||
return rf(fileId)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(domain.FileId) string); ok {
|
||||
if rf, ok := ret.Get(0).(func(domain.FullFileId) string); ok {
|
||||
r0 = rf(fileId)
|
||||
} else {
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(domain.FileId) error); ok {
|
||||
if rf, ok := ret.Get(1).(func(domain.FullFileId) *types.Struct); ok {
|
||||
r1 = rf(fileId)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*types.Struct)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
if rf, ok := ret.Get(2).(func(domain.FullFileId) error); ok {
|
||||
r2 = rf(fileId)
|
||||
} else {
|
||||
r2 = ret.Error(2)
|
||||
}
|
||||
|
||||
return r0, r1, r2
|
||||
}
|
||||
|
||||
// MockService_GetObjectIdByFileId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetObjectIdByFileId'
|
||||
type MockService_GetObjectIdByFileId_Call struct {
|
||||
// MockService_GetObjectDetailsByFileId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetObjectDetailsByFileId'
|
||||
type MockService_GetObjectDetailsByFileId_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetObjectIdByFileId is a helper method to define mock.On call
|
||||
// - fileId domain.FileId
|
||||
func (_e *MockService_Expecter) GetObjectIdByFileId(fileId interface{}) *MockService_GetObjectIdByFileId_Call {
|
||||
return &MockService_GetObjectIdByFileId_Call{Call: _e.mock.On("GetObjectIdByFileId", fileId)}
|
||||
// GetObjectDetailsByFileId is a helper method to define mock.On call
|
||||
// - fileId domain.FullFileId
|
||||
func (_e *MockService_Expecter) GetObjectDetailsByFileId(fileId interface{}) *MockService_GetObjectDetailsByFileId_Call {
|
||||
return &MockService_GetObjectDetailsByFileId_Call{Call: _e.mock.On("GetObjectDetailsByFileId", fileId)}
|
||||
}
|
||||
|
||||
func (_c *MockService_GetObjectIdByFileId_Call) Run(run func(fileId domain.FileId)) *MockService_GetObjectIdByFileId_Call {
|
||||
func (_c *MockService_GetObjectDetailsByFileId_Call) Run(run func(fileId domain.FullFileId)) *MockService_GetObjectDetailsByFileId_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(domain.FileId))
|
||||
run(args[0].(domain.FullFileId))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_GetObjectIdByFileId_Call) Return(_a0 string, _a1 error) *MockService_GetObjectIdByFileId_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
func (_c *MockService_GetObjectDetailsByFileId_Call) Return(_a0 string, _a1 *types.Struct, _a2 error) *MockService_GetObjectDetailsByFileId_Call {
|
||||
_c.Call.Return(_a0, _a1, _a2)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_GetObjectIdByFileId_Call) RunAndReturn(run func(domain.FileId) (string, error)) *MockService_GetObjectIdByFileId_Call {
|
||||
func (_c *MockService_GetObjectDetailsByFileId_Call) RunAndReturn(run func(domain.FullFileId) (string, *types.Struct, error)) *MockService_GetObjectDetailsByFileId_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
|
|
@ -245,8 +245,8 @@ func (h *history) buildState(id domain.FullID, versionId string) (st *state.Stat
|
|||
}
|
||||
|
||||
func (h *history) getProfileInfo(spaceId string) (profileId, profileName string, err error) {
|
||||
profileId = h.accountService.ParticipantId(spaceId)
|
||||
lp, err := h.accountService.LocalProfile()
|
||||
profileId = h.accountService.MyParticipantId(spaceId)
|
||||
lp, err := h.accountService.ProfileInfo()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -8,11 +8,14 @@ import (
|
|||
"github.com/anyproto/any-sync/commonfile/fileservice"
|
||||
"github.com/anyproto/any-sync/util/crypto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/anyproto/anytype-heart/core/filestorage"
|
||||
"github.com/anyproto/anytype-heart/core/filestorage/filesync/mock_filesync"
|
||||
"github.com/anyproto/anytype-heart/core/filestorage/rpcstore"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/pb/model"
|
||||
"github.com/anyproto/anytype-heart/tests/testutil"
|
||||
)
|
||||
|
||||
type fixture struct {
|
||||
|
@ -24,12 +27,15 @@ func newFixture(t *testing.T) *fixture {
|
|||
rpcStore := rpcstore.NewInMemoryStore(1024)
|
||||
rpcStoreService := rpcstore.NewInMemoryService(rpcStore)
|
||||
commonFileService := fileservice.New()
|
||||
fileSyncService := mock_filesync.NewMockFileSync(t)
|
||||
fileSyncService.EXPECT().AddFile(mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe()
|
||||
|
||||
ctx := context.Background()
|
||||
a := new(app.App)
|
||||
a.Register(blockStorage)
|
||||
a.Register(rpcStoreService)
|
||||
a.Register(commonFileService)
|
||||
a.Register(testutil.PrepareMock(ctx, a, fileSyncService))
|
||||
err := a.Start(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -56,7 +62,7 @@ func TestStore(t *testing.T) {
|
|||
Payload: payload,
|
||||
Signature: signature,
|
||||
}
|
||||
id, key, err := fx.StoreInvite(ctx, wantInvite)
|
||||
id, key, err := fx.StoreInvite(ctx, "space1", wantInvite)
|
||||
require.NoError(t, err)
|
||||
|
||||
gotInvite, err := fx.GetInvite(ctx, id, key)
|
||||
|
|
|
@ -16,7 +16,6 @@ import (
|
|||
"github.com/anyproto/anytype-heart/core/event"
|
||||
"github.com/anyproto/anytype-heart/core/event/mock_event"
|
||||
"github.com/anyproto/anytype-heart/core/kanban"
|
||||
"github.com/anyproto/anytype-heart/core/subscription/mock_subscription"
|
||||
"github.com/anyproto/anytype-heart/pb"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/localstore/objectstore"
|
||||
"github.com/anyproto/anytype-heart/space/spacecore/typeprovider/mock_typeprovider"
|
||||
|
@ -25,7 +24,7 @@ import (
|
|||
)
|
||||
|
||||
type collectionServiceMock struct {
|
||||
*mock_subscription.MockCollectionService
|
||||
*MockCollectionService
|
||||
}
|
||||
|
||||
func (c *collectionServiceMock) Name() string {
|
||||
|
@ -55,7 +54,7 @@ func newFixture(t *testing.T) *fixture {
|
|||
sbtProvider.EXPECT().Init(mock.Anything).Return(nil)
|
||||
a.Register(sbtProvider)
|
||||
|
||||
collectionService := &collectionServiceMock{MockCollectionService: mock_subscription.NewMockCollectionService(t)}
|
||||
collectionService := &collectionServiceMock{MockCollectionService: NewMockCollectionService(t)}
|
||||
a.Register(collectionService)
|
||||
|
||||
fx := &fixture{
|
||||
|
@ -102,7 +101,7 @@ func newFixtureWithRealObjectStore(t *testing.T) *fixtureRealStore {
|
|||
kanbanService := kanban.New()
|
||||
a.Register(kanbanService)
|
||||
|
||||
collectionService := &collectionServiceMock{MockCollectionService: mock_subscription.NewMockCollectionService(t)}
|
||||
collectionService := &collectionServiceMock{MockCollectionService: NewMockCollectionService(t)}
|
||||
a.Register(collectionService)
|
||||
|
||||
sbtProvider := mock_typeprovider.NewMockSmartBlockTypeProvider(t)
|
||||
|
|
|
@ -1,134 +0,0 @@
|
|||
// Code generated by mockery. DO NOT EDIT.
|
||||
|
||||
package mock_subscription
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
|
||||
// MockCollectionService is an autogenerated mock type for the CollectionService type
|
||||
type MockCollectionService struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type MockCollectionService_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *MockCollectionService) EXPECT() *MockCollectionService_Expecter {
|
||||
return &MockCollectionService_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// SubscribeForCollection provides a mock function with given fields: collectionID, subscriptionID
|
||||
func (_m *MockCollectionService) SubscribeForCollection(collectionID string, subscriptionID string) ([]string, <-chan []string, error) {
|
||||
ret := _m.Called(collectionID, subscriptionID)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for SubscribeForCollection")
|
||||
}
|
||||
|
||||
var r0 []string
|
||||
var r1 <-chan []string
|
||||
var r2 error
|
||||
if rf, ok := ret.Get(0).(func(string, string) ([]string, <-chan []string, error)); ok {
|
||||
return rf(collectionID, subscriptionID)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, string) []string); ok {
|
||||
r0 = rf(collectionID, subscriptionID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]string)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, string) <-chan []string); ok {
|
||||
r1 = rf(collectionID, subscriptionID)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(<-chan []string)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(2).(func(string, string) error); ok {
|
||||
r2 = rf(collectionID, subscriptionID)
|
||||
} else {
|
||||
r2 = ret.Error(2)
|
||||
}
|
||||
|
||||
return r0, r1, r2
|
||||
}
|
||||
|
||||
// MockCollectionService_SubscribeForCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SubscribeForCollection'
|
||||
type MockCollectionService_SubscribeForCollection_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SubscribeForCollection is a helper method to define mock.On call
|
||||
// - collectionID string
|
||||
// - subscriptionID string
|
||||
func (_e *MockCollectionService_Expecter) SubscribeForCollection(collectionID interface{}, subscriptionID interface{}) *MockCollectionService_SubscribeForCollection_Call {
|
||||
return &MockCollectionService_SubscribeForCollection_Call{Call: _e.mock.On("SubscribeForCollection", collectionID, subscriptionID)}
|
||||
}
|
||||
|
||||
func (_c *MockCollectionService_SubscribeForCollection_Call) Run(run func(collectionID string, subscriptionID string)) *MockCollectionService_SubscribeForCollection_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCollectionService_SubscribeForCollection_Call) Return(_a0 []string, _a1 <-chan []string, _a2 error) *MockCollectionService_SubscribeForCollection_Call {
|
||||
_c.Call.Return(_a0, _a1, _a2)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCollectionService_SubscribeForCollection_Call) RunAndReturn(run func(string, string) ([]string, <-chan []string, error)) *MockCollectionService_SubscribeForCollection_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// UnsubscribeFromCollection provides a mock function with given fields: collectionID, subscriptionID
|
||||
func (_m *MockCollectionService) UnsubscribeFromCollection(collectionID string, subscriptionID string) {
|
||||
_m.Called(collectionID, subscriptionID)
|
||||
}
|
||||
|
||||
// MockCollectionService_UnsubscribeFromCollection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnsubscribeFromCollection'
|
||||
type MockCollectionService_UnsubscribeFromCollection_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// UnsubscribeFromCollection is a helper method to define mock.On call
|
||||
// - collectionID string
|
||||
// - subscriptionID string
|
||||
func (_e *MockCollectionService_Expecter) UnsubscribeFromCollection(collectionID interface{}, subscriptionID interface{}) *MockCollectionService_UnsubscribeFromCollection_Call {
|
||||
return &MockCollectionService_UnsubscribeFromCollection_Call{Call: _e.mock.On("UnsubscribeFromCollection", collectionID, subscriptionID)}
|
||||
}
|
||||
|
||||
func (_c *MockCollectionService_UnsubscribeFromCollection_Call) Run(run func(collectionID string, subscriptionID string)) *MockCollectionService_UnsubscribeFromCollection_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCollectionService_UnsubscribeFromCollection_Call) Return() *MockCollectionService_UnsubscribeFromCollection_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockCollectionService_UnsubscribeFromCollection_Call) RunAndReturn(run func(string, string)) *MockCollectionService_UnsubscribeFromCollection_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockCollectionService creates a new instance of MockCollectionService. 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 NewMockCollectionService(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockCollectionService {
|
||||
mock := &MockCollectionService{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
|
@ -1,612 +0,0 @@
|
|||
// Code generated by mockery. DO NOT EDIT.
|
||||
|
||||
package mock_subscription
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
app "github.com/anyproto/any-sync/app"
|
||||
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
pb "github.com/anyproto/anytype-heart/pb"
|
||||
|
||||
session "github.com/anyproto/anytype-heart/core/session"
|
||||
|
||||
types "github.com/gogo/protobuf/types"
|
||||
)
|
||||
|
||||
// MockService is an autogenerated mock type for the Service type
|
||||
type MockService struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type MockService_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *MockService) EXPECT() *MockService_Expecter {
|
||||
return &MockService_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// Close provides a mock function with given fields: ctx
|
||||
func (_m *MockService) Close(ctx context.Context) error {
|
||||
ret := _m.Called(ctx)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Close")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
|
||||
r0 = rf(ctx)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockService_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
|
||||
type MockService_Close_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Close is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
func (_e *MockService_Expecter) Close(ctx interface{}) *MockService_Close_Call {
|
||||
return &MockService_Close_Call{Call: _e.mock.On("Close", ctx)}
|
||||
}
|
||||
|
||||
func (_c *MockService_Close_Call) Run(run func(ctx context.Context)) *MockService_Close_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Close_Call) Return(err error) *MockService_Close_Call {
|
||||
_c.Call.Return(err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Close_Call) RunAndReturn(run func(context.Context) error) *MockService_Close_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Init provides a mock function with given fields: a
|
||||
func (_m *MockService) Init(a *app.App) error {
|
||||
ret := _m.Called(a)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Init")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(*app.App) error); ok {
|
||||
r0 = rf(a)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockService_Init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Init'
|
||||
type MockService_Init_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Init is a helper method to define mock.On call
|
||||
// - a *app.App
|
||||
func (_e *MockService_Expecter) Init(a interface{}) *MockService_Init_Call {
|
||||
return &MockService_Init_Call{Call: _e.mock.On("Init", a)}
|
||||
}
|
||||
|
||||
func (_c *MockService_Init_Call) Run(run func(a *app.App)) *MockService_Init_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(*app.App))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Init_Call) Return(err error) *MockService_Init_Call {
|
||||
_c.Call.Return(err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Init_Call) RunAndReturn(run func(*app.App) error) *MockService_Init_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Name provides a mock function with given fields:
|
||||
func (_m *MockService) Name() string {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Name")
|
||||
}
|
||||
|
||||
var r0 string
|
||||
if rf, ok := ret.Get(0).(func() string); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockService_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'
|
||||
type MockService_Name_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Name is a helper method to define mock.On call
|
||||
func (_e *MockService_Expecter) Name() *MockService_Name_Call {
|
||||
return &MockService_Name_Call{Call: _e.mock.On("Name")}
|
||||
}
|
||||
|
||||
func (_c *MockService_Name_Call) Run(run func()) *MockService_Name_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Name_Call) Return(name string) *MockService_Name_Call {
|
||||
_c.Call.Return(name)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Name_Call) RunAndReturn(run func() string) *MockService_Name_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Run provides a mock function with given fields: ctx
|
||||
func (_m *MockService) Run(ctx context.Context) error {
|
||||
ret := _m.Called(ctx)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Run")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context) error); ok {
|
||||
r0 = rf(ctx)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockService_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run'
|
||||
type MockService_Run_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Run is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
func (_e *MockService_Expecter) Run(ctx interface{}) *MockService_Run_Call {
|
||||
return &MockService_Run_Call{Call: _e.mock.On("Run", ctx)}
|
||||
}
|
||||
|
||||
func (_c *MockService_Run_Call) Run(run func(ctx context.Context)) *MockService_Run_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Run_Call) Return(err error) *MockService_Run_Call {
|
||||
_c.Call.Return(err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Run_Call) RunAndReturn(run func(context.Context) error) *MockService_Run_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Search provides a mock function with given fields: req
|
||||
func (_m *MockService) Search(req pb.RpcObjectSearchSubscribeRequest) (*pb.RpcObjectSearchSubscribeResponse, error) {
|
||||
ret := _m.Called(req)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Search")
|
||||
}
|
||||
|
||||
var r0 *pb.RpcObjectSearchSubscribeResponse
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(pb.RpcObjectSearchSubscribeRequest) (*pb.RpcObjectSearchSubscribeResponse, error)); ok {
|
||||
return rf(req)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(pb.RpcObjectSearchSubscribeRequest) *pb.RpcObjectSearchSubscribeResponse); ok {
|
||||
r0 = rf(req)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*pb.RpcObjectSearchSubscribeResponse)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(pb.RpcObjectSearchSubscribeRequest) error); ok {
|
||||
r1 = rf(req)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockService_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search'
|
||||
type MockService_Search_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Search is a helper method to define mock.On call
|
||||
// - req pb.RpcObjectSearchSubscribeRequest
|
||||
func (_e *MockService_Expecter) Search(req interface{}) *MockService_Search_Call {
|
||||
return &MockService_Search_Call{Call: _e.mock.On("Search", req)}
|
||||
}
|
||||
|
||||
func (_c *MockService_Search_Call) Run(run func(req pb.RpcObjectSearchSubscribeRequest)) *MockService_Search_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(pb.RpcObjectSearchSubscribeRequest))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Search_Call) Return(resp *pb.RpcObjectSearchSubscribeResponse, err error) *MockService_Search_Call {
|
||||
_c.Call.Return(resp, err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Search_Call) RunAndReturn(run func(pb.RpcObjectSearchSubscribeRequest) (*pb.RpcObjectSearchSubscribeResponse, error)) *MockService_Search_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SubscribeGroups provides a mock function with given fields: ctx, req
|
||||
func (_m *MockService) SubscribeGroups(ctx session.Context, req pb.RpcObjectGroupsSubscribeRequest) (*pb.RpcObjectGroupsSubscribeResponse, error) {
|
||||
ret := _m.Called(ctx, req)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for SubscribeGroups")
|
||||
}
|
||||
|
||||
var r0 *pb.RpcObjectGroupsSubscribeResponse
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(session.Context, pb.RpcObjectGroupsSubscribeRequest) (*pb.RpcObjectGroupsSubscribeResponse, error)); ok {
|
||||
return rf(ctx, req)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(session.Context, pb.RpcObjectGroupsSubscribeRequest) *pb.RpcObjectGroupsSubscribeResponse); ok {
|
||||
r0 = rf(ctx, req)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*pb.RpcObjectGroupsSubscribeResponse)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(session.Context, pb.RpcObjectGroupsSubscribeRequest) error); ok {
|
||||
r1 = rf(ctx, req)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockService_SubscribeGroups_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SubscribeGroups'
|
||||
type MockService_SubscribeGroups_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SubscribeGroups is a helper method to define mock.On call
|
||||
// - ctx session.Context
|
||||
// - req pb.RpcObjectGroupsSubscribeRequest
|
||||
func (_e *MockService_Expecter) SubscribeGroups(ctx interface{}, req interface{}) *MockService_SubscribeGroups_Call {
|
||||
return &MockService_SubscribeGroups_Call{Call: _e.mock.On("SubscribeGroups", ctx, req)}
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscribeGroups_Call) Run(run func(ctx session.Context, req pb.RpcObjectGroupsSubscribeRequest)) *MockService_SubscribeGroups_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(session.Context), args[1].(pb.RpcObjectGroupsSubscribeRequest))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscribeGroups_Call) Return(_a0 *pb.RpcObjectGroupsSubscribeResponse, _a1 error) *MockService_SubscribeGroups_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscribeGroups_Call) RunAndReturn(run func(session.Context, pb.RpcObjectGroupsSubscribeRequest) (*pb.RpcObjectGroupsSubscribeResponse, error)) *MockService_SubscribeGroups_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SubscribeIds provides a mock function with given fields: subId, ids
|
||||
func (_m *MockService) SubscribeIds(subId string, ids []string) ([]*types.Struct, error) {
|
||||
ret := _m.Called(subId, ids)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for SubscribeIds")
|
||||
}
|
||||
|
||||
var r0 []*types.Struct
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(string, []string) ([]*types.Struct, error)); ok {
|
||||
return rf(subId, ids)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, []string) []*types.Struct); ok {
|
||||
r0 = rf(subId, ids)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*types.Struct)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, []string) error); ok {
|
||||
r1 = rf(subId, ids)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockService_SubscribeIds_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SubscribeIds'
|
||||
type MockService_SubscribeIds_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SubscribeIds is a helper method to define mock.On call
|
||||
// - subId string
|
||||
// - ids []string
|
||||
func (_e *MockService_Expecter) SubscribeIds(subId interface{}, ids interface{}) *MockService_SubscribeIds_Call {
|
||||
return &MockService_SubscribeIds_Call{Call: _e.mock.On("SubscribeIds", subId, ids)}
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscribeIds_Call) Run(run func(subId string, ids []string)) *MockService_SubscribeIds_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].([]string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscribeIds_Call) Return(records []*types.Struct, err error) *MockService_SubscribeIds_Call {
|
||||
_c.Call.Return(records, err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscribeIds_Call) RunAndReturn(run func(string, []string) ([]*types.Struct, error)) *MockService_SubscribeIds_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SubscribeIdsReq provides a mock function with given fields: req
|
||||
func (_m *MockService) SubscribeIdsReq(req pb.RpcObjectSubscribeIdsRequest) (*pb.RpcObjectSubscribeIdsResponse, error) {
|
||||
ret := _m.Called(req)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for SubscribeIdsReq")
|
||||
}
|
||||
|
||||
var r0 *pb.RpcObjectSubscribeIdsResponse
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(pb.RpcObjectSubscribeIdsRequest) (*pb.RpcObjectSubscribeIdsResponse, error)); ok {
|
||||
return rf(req)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(pb.RpcObjectSubscribeIdsRequest) *pb.RpcObjectSubscribeIdsResponse); ok {
|
||||
r0 = rf(req)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*pb.RpcObjectSubscribeIdsResponse)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(pb.RpcObjectSubscribeIdsRequest) error); ok {
|
||||
r1 = rf(req)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockService_SubscribeIdsReq_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SubscribeIdsReq'
|
||||
type MockService_SubscribeIdsReq_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SubscribeIdsReq is a helper method to define mock.On call
|
||||
// - req pb.RpcObjectSubscribeIdsRequest
|
||||
func (_e *MockService_Expecter) SubscribeIdsReq(req interface{}) *MockService_SubscribeIdsReq_Call {
|
||||
return &MockService_SubscribeIdsReq_Call{Call: _e.mock.On("SubscribeIdsReq", req)}
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscribeIdsReq_Call) Run(run func(req pb.RpcObjectSubscribeIdsRequest)) *MockService_SubscribeIdsReq_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(pb.RpcObjectSubscribeIdsRequest))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscribeIdsReq_Call) Return(resp *pb.RpcObjectSubscribeIdsResponse, err error) *MockService_SubscribeIdsReq_Call {
|
||||
_c.Call.Return(resp, err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscribeIdsReq_Call) RunAndReturn(run func(pb.RpcObjectSubscribeIdsRequest) (*pb.RpcObjectSubscribeIdsResponse, error)) *MockService_SubscribeIdsReq_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SubscriptionIDs provides a mock function with given fields:
|
||||
func (_m *MockService) SubscriptionIDs() []string {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for SubscriptionIDs")
|
||||
}
|
||||
|
||||
var r0 []string
|
||||
if rf, ok := ret.Get(0).(func() []string); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]string)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockService_SubscriptionIDs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SubscriptionIDs'
|
||||
type MockService_SubscriptionIDs_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SubscriptionIDs is a helper method to define mock.On call
|
||||
func (_e *MockService_Expecter) SubscriptionIDs() *MockService_SubscriptionIDs_Call {
|
||||
return &MockService_SubscriptionIDs_Call{Call: _e.mock.On("SubscriptionIDs")}
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscriptionIDs_Call) Run(run func()) *MockService_SubscriptionIDs_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscriptionIDs_Call) Return(_a0 []string) *MockService_SubscriptionIDs_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_SubscriptionIDs_Call) RunAndReturn(run func() []string) *MockService_SubscriptionIDs_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Unsubscribe provides a mock function with given fields: subIds
|
||||
func (_m *MockService) Unsubscribe(subIds ...string) error {
|
||||
_va := make([]interface{}, len(subIds))
|
||||
for _i := range subIds {
|
||||
_va[_i] = subIds[_i]
|
||||
}
|
||||
var _ca []interface{}
|
||||
_ca = append(_ca, _va...)
|
||||
ret := _m.Called(_ca...)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Unsubscribe")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(...string) error); ok {
|
||||
r0 = rf(subIds...)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockService_Unsubscribe_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Unsubscribe'
|
||||
type MockService_Unsubscribe_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Unsubscribe is a helper method to define mock.On call
|
||||
// - subIds ...string
|
||||
func (_e *MockService_Expecter) Unsubscribe(subIds ...interface{}) *MockService_Unsubscribe_Call {
|
||||
return &MockService_Unsubscribe_Call{Call: _e.mock.On("Unsubscribe",
|
||||
append([]interface{}{}, subIds...)...)}
|
||||
}
|
||||
|
||||
func (_c *MockService_Unsubscribe_Call) Run(run func(subIds ...string)) *MockService_Unsubscribe_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
variadicArgs := make([]string, len(args)-0)
|
||||
for i, a := range args[0:] {
|
||||
if a != nil {
|
||||
variadicArgs[i] = a.(string)
|
||||
}
|
||||
}
|
||||
run(variadicArgs...)
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Unsubscribe_Call) Return(err error) *MockService_Unsubscribe_Call {
|
||||
_c.Call.Return(err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_Unsubscribe_Call) RunAndReturn(run func(...string) error) *MockService_Unsubscribe_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// UnsubscribeAll provides a mock function with given fields:
|
||||
func (_m *MockService) UnsubscribeAll() error {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for UnsubscribeAll")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func() error); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockService_UnsubscribeAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnsubscribeAll'
|
||||
type MockService_UnsubscribeAll_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// UnsubscribeAll is a helper method to define mock.On call
|
||||
func (_e *MockService_Expecter) UnsubscribeAll() *MockService_UnsubscribeAll_Call {
|
||||
return &MockService_UnsubscribeAll_Call{Call: _e.mock.On("UnsubscribeAll")}
|
||||
}
|
||||
|
||||
func (_c *MockService_UnsubscribeAll_Call) Run(run func()) *MockService_UnsubscribeAll_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_UnsubscribeAll_Call) Return(err error) *MockService_UnsubscribeAll_Call {
|
||||
_c.Call.Return(err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_UnsubscribeAll_Call) RunAndReturn(run func() error) *MockService_UnsubscribeAll_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMockService creates a new instance of MockService. 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 NewMockService(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *MockService {
|
||||
mock := &MockService{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
|
@ -1,294 +0,0 @@
|
|||
// Code generated by mockery. DO NOT EDIT.
|
||||
|
||||
package mock_subscription
|
||||
|
||||
import (
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
types "github.com/gogo/protobuf/types"
|
||||
)
|
||||
|
||||
// Mocksubscription is an autogenerated mock type for the subscription type
|
||||
type Mocksubscription struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type Mocksubscription_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *Mocksubscription) EXPECT() *Mocksubscription_Expecter {
|
||||
return &Mocksubscription_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// close provides a mock function with given fields:
|
||||
func (_m *Mocksubscription) close() {
|
||||
_m.Called()
|
||||
}
|
||||
|
||||
// Mocksubscription_close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'close'
|
||||
type Mocksubscription_close_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// close is a helper method to define mock.On call
|
||||
func (_e *Mocksubscription_Expecter) close() *Mocksubscription_close_Call {
|
||||
return &Mocksubscription_close_Call{Call: _e.mock.On("close")}
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_close_Call) Run(run func()) *Mocksubscription_close_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_close_Call) Return() *Mocksubscription_close_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_close_Call) RunAndReturn(run func()) *Mocksubscription_close_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// counters provides a mock function with given fields:
|
||||
func (_m *Mocksubscription) counters() (int, int) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for counters")
|
||||
}
|
||||
|
||||
var r0 int
|
||||
var r1 int
|
||||
if rf, ok := ret.Get(0).(func() (int, int)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() int); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(int)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() int); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Get(1).(int)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Mocksubscription_counters_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'counters'
|
||||
type Mocksubscription_counters_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// counters is a helper method to define mock.On call
|
||||
func (_e *Mocksubscription_Expecter) counters() *Mocksubscription_counters_Call {
|
||||
return &Mocksubscription_counters_Call{Call: _e.mock.On("counters")}
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_counters_Call) Run(run func()) *Mocksubscription_counters_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_counters_Call) Return(prev int, next int) *Mocksubscription_counters_Call {
|
||||
_c.Call.Return(prev, next)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_counters_Call) RunAndReturn(run func() (int, int)) *Mocksubscription_counters_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// getActiveRecords provides a mock function with given fields:
|
||||
func (_m *Mocksubscription) getActiveRecords() []*types.Struct {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for getActiveRecords")
|
||||
}
|
||||
|
||||
var r0 []*types.Struct
|
||||
if rf, ok := ret.Get(0).(func() []*types.Struct); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*types.Struct)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// Mocksubscription_getActiveRecords_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'getActiveRecords'
|
||||
type Mocksubscription_getActiveRecords_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// getActiveRecords is a helper method to define mock.On call
|
||||
func (_e *Mocksubscription_Expecter) getActiveRecords() *Mocksubscription_getActiveRecords_Call {
|
||||
return &Mocksubscription_getActiveRecords_Call{Call: _e.mock.On("getActiveRecords")}
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_getActiveRecords_Call) Run(run func()) *Mocksubscription_getActiveRecords_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_getActiveRecords_Call) Return(res []*types.Struct) *Mocksubscription_getActiveRecords_Call {
|
||||
_c.Call.Return(res)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_getActiveRecords_Call) RunAndReturn(run func() []*types.Struct) *Mocksubscription_getActiveRecords_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// hasDep provides a mock function with given fields:
|
||||
func (_m *Mocksubscription) hasDep() bool {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for hasDep")
|
||||
}
|
||||
|
||||
var r0 bool
|
||||
if rf, ok := ret.Get(0).(func() bool); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(bool)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// Mocksubscription_hasDep_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'hasDep'
|
||||
type Mocksubscription_hasDep_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// hasDep is a helper method to define mock.On call
|
||||
func (_e *Mocksubscription_Expecter) hasDep() *Mocksubscription_hasDep_Call {
|
||||
return &Mocksubscription_hasDep_Call{Call: _e.mock.On("hasDep")}
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_hasDep_Call) Run(run func()) *Mocksubscription_hasDep_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_hasDep_Call) Return(_a0 bool) *Mocksubscription_hasDep_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_hasDep_Call) RunAndReturn(run func() bool) *Mocksubscription_hasDep_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// init provides a mock function with given fields: entries
|
||||
func (_m *Mocksubscription) init(entries []*subscription.entry) error {
|
||||
ret := _m.Called(entries)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for init")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func([]*subscription.entry) error); ok {
|
||||
r0 = rf(entries)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// Mocksubscription_init_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'init'
|
||||
type Mocksubscription_init_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// init is a helper method to define mock.On call
|
||||
// - entries []*subscription.entry
|
||||
func (_e *Mocksubscription_Expecter) init(entries interface{}) *Mocksubscription_init_Call {
|
||||
return &Mocksubscription_init_Call{Call: _e.mock.On("init", entries)}
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_init_Call) Run(run func(entries []*subscription.entry)) *Mocksubscription_init_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].([]*subscription.entry))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_init_Call) Return(err error) *Mocksubscription_init_Call {
|
||||
_c.Call.Return(err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_init_Call) RunAndReturn(run func([]*subscription.entry) error) *Mocksubscription_init_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// onChange provides a mock function with given fields: ctx
|
||||
func (_m *Mocksubscription) onChange(ctx *subscription.opCtx) {
|
||||
_m.Called(ctx)
|
||||
}
|
||||
|
||||
// Mocksubscription_onChange_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'onChange'
|
||||
type Mocksubscription_onChange_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// onChange is a helper method to define mock.On call
|
||||
// - ctx *subscription.opCtx
|
||||
func (_e *Mocksubscription_Expecter) onChange(ctx interface{}) *Mocksubscription_onChange_Call {
|
||||
return &Mocksubscription_onChange_Call{Call: _e.mock.On("onChange", ctx)}
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_onChange_Call) Run(run func(ctx *subscription.opCtx)) *Mocksubscription_onChange_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(*subscription.opCtx))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_onChange_Call) Return() *Mocksubscription_onChange_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Mocksubscription_onChange_Call) RunAndReturn(run func(*subscription.opCtx)) *Mocksubscription_onChange_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewMocksubscription creates a new instance of Mocksubscription. 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 NewMocksubscription(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *Mocksubscription {
|
||||
mock := &Mocksubscription{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||
|
||||
return mock
|
||||
}
|
|
@ -16,7 +16,6 @@ import (
|
|||
app "github.com/anyproto/any-sync/app"
|
||||
state "github.com/anyproto/anytype-heart/core/block/editor/state"
|
||||
source "github.com/anyproto/anytype-heart/core/block/source"
|
||||
domain "github.com/anyproto/anytype-heart/core/domain"
|
||||
pb "github.com/anyproto/anytype-heart/pb"
|
||||
smartblock "github.com/anyproto/anytype-heart/pkg/lib/core/smartblock"
|
||||
types "github.com/gogo/protobuf/types"
|
||||
|
@ -120,17 +119,17 @@ func (mr *MockServiceMockRecorder) NewSource(arg0, arg1, arg2, arg3 any) *gomock
|
|||
}
|
||||
|
||||
// NewStaticSource mocks base method.
|
||||
func (m *MockService) NewStaticSource(arg0 domain.FullID, arg1 smartblock.SmartBlockType, arg2 *state.State, arg3 string, arg4 func(source.PushChangeParams) (string, error)) source.SourceWithType {
|
||||
func (m *MockService) NewStaticSource(arg0 source.StaticSourceParams) source.SourceWithType {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NewStaticSource", arg0, arg1, arg2, arg3, arg4)
|
||||
ret := m.ctrl.Call(m, "NewStaticSource", arg0)
|
||||
ret0, _ := ret[0].(source.SourceWithType)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// NewStaticSource indicates an expected call of NewStaticSource.
|
||||
func (mr *MockServiceMockRecorder) NewStaticSource(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call {
|
||||
func (mr *MockServiceMockRecorder) NewStaticSource(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewStaticSource", reflect.TypeOf((*MockService)(nil).NewStaticSource), arg0, arg1, arg2, arg3, arg4)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewStaticSource", reflect.TypeOf((*MockService)(nil).NewStaticSource), arg0)
|
||||
}
|
||||
|
||||
// RegisterStaticSource mocks base method.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue