mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-08 05:47:07 +09:00
GO-4400 Fix invite service tests and workspace tests
This commit is contained in:
parent
e0acaebba3
commit
e556437360
11 changed files with 240 additions and 264 deletions
|
@ -365,7 +365,7 @@ func TestService_ViewInvite(t *testing.T) {
|
|||
InviteRevokes: invRecIds,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
err = aclList.AddRawRecord(list.WrapAclRecord(removeInv))
|
||||
err = aclList.AddRawRecord(list.WrapAclRecord(removeInv.Rec))
|
||||
require.NoError(t, err)
|
||||
recs, err := aclList.RecordsAfter(ctx, "")
|
||||
require.NoError(t, err)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package editor
|
||||
|
||||
import (
|
||||
"github.com/anyproto/any-sync/commonspace/object/acl/list"
|
||||
|
||||
"github.com/anyproto/anytype-heart/core/anytype/config"
|
||||
"github.com/anyproto/anytype-heart/core/block/editor/basic"
|
||||
"github.com/anyproto/anytype-heart/core/block/editor/dataview"
|
||||
|
@ -110,6 +112,9 @@ func (w *Workspaces) GetExistingInviteInfo() (inviteInfo domain.InviteInfo) {
|
|||
inviteInfo.Permissions = domain.ConvertParticipantPermissions(model.ParticipantPermissions(details.GetInt64(bundle.RelationKeySpaceInvitePermissions)))
|
||||
inviteInfo.InviteFileCid = details.GetString(bundle.RelationKeySpaceInviteFileCid)
|
||||
inviteInfo.InviteFileKey = details.GetString(bundle.RelationKeySpaceInviteFileKey)
|
||||
if inviteInfo.InviteType == domain.InviteTypeDefault {
|
||||
inviteInfo.Permissions = list.AclPermissionsNone
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package editor
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/anyproto/any-sync/commonspace/object/acl/list"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
||||
|
@ -11,23 +12,29 @@ import (
|
|||
"github.com/anyproto/anytype-heart/core/block/editor/smartblock/smarttest"
|
||||
"github.com/anyproto/anytype-heart/core/block/editor/state"
|
||||
"github.com/anyproto/anytype-heart/core/block/migration"
|
||||
"github.com/anyproto/anytype-heart/core/domain"
|
||||
)
|
||||
|
||||
func TestWorkspaces_FileInfo(t *testing.T) {
|
||||
t.Run("file info add remove", func(t *testing.T) {
|
||||
fx := newWorkspacesFixture(t)
|
||||
defer fx.finish()
|
||||
err := fx.SetInviteFileInfo("fileId", "fileKey")
|
||||
info := domain.InviteInfo{
|
||||
InviteFileCid: "fileId",
|
||||
InviteFileKey: "fileKey",
|
||||
InviteType: domain.InviteTypeAnyone,
|
||||
Permissions: list.AclPermissionsWriter,
|
||||
}
|
||||
err := fx.SetInviteFileInfo(info)
|
||||
require.NoError(t, err)
|
||||
fileId, fileKey := fx.GetExistingInviteInfo()
|
||||
require.Equal(t, "fileId", fileId)
|
||||
require.Equal(t, "fileKey", fileKey)
|
||||
fileId, err = fx.RemoveExistingInviteInfo()
|
||||
returnedInfo := fx.GetExistingInviteInfo()
|
||||
require.Equal(t, info, returnedInfo)
|
||||
returnedInfo, err = fx.RemoveExistingInviteInfo()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "fileId", fileId)
|
||||
fileId, err = fx.RemoveExistingInviteInfo()
|
||||
require.Equal(t, info, returnedInfo)
|
||||
returnedInfo, err = fx.RemoveExistingInviteInfo()
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, fileId)
|
||||
require.Empty(t, returnedInfo)
|
||||
})
|
||||
t.Run("file info empty", func(t *testing.T) {
|
||||
fx := newWorkspacesFixture(t)
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
package mock_domain
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import (
|
||||
domain "github.com/anyproto/anytype-heart/core/domain"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
// MockInviteObject is an autogenerated mock type for the InviteObject type
|
||||
type MockInviteObject struct {
|
||||
|
@ -73,31 +76,21 @@ func (_c *MockInviteObject_GetExistingGuestInviteInfo_Call) RunAndReturn(run fun
|
|||
}
|
||||
|
||||
// GetExistingInviteInfo provides a mock function with given fields:
|
||||
func (_m *MockInviteObject) GetExistingInviteInfo() (string, string) {
|
||||
func (_m *MockInviteObject) GetExistingInviteInfo() domain.InviteInfo {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetExistingInviteInfo")
|
||||
}
|
||||
|
||||
var r0 string
|
||||
var r1 string
|
||||
if rf, ok := ret.Get(0).(func() (string, string)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() string); ok {
|
||||
var r0 domain.InviteInfo
|
||||
if rf, ok := ret.Get(0).(func() domain.InviteInfo); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(string)
|
||||
r0 = ret.Get(0).(domain.InviteInfo)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() string); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Get(1).(string)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockInviteObject_GetExistingInviteInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetExistingInviteInfo'
|
||||
|
@ -117,33 +110,33 @@ func (_c *MockInviteObject_GetExistingInviteInfo_Call) Run(run func()) *MockInvi
|
|||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInviteObject_GetExistingInviteInfo_Call) Return(fileCid string, fileKey string) *MockInviteObject_GetExistingInviteInfo_Call {
|
||||
_c.Call.Return(fileCid, fileKey)
|
||||
func (_c *MockInviteObject_GetExistingInviteInfo_Call) Return(_a0 domain.InviteInfo) *MockInviteObject_GetExistingInviteInfo_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInviteObject_GetExistingInviteInfo_Call) RunAndReturn(run func() (string, string)) *MockInviteObject_GetExistingInviteInfo_Call {
|
||||
func (_c *MockInviteObject_GetExistingInviteInfo_Call) RunAndReturn(run func() domain.InviteInfo) *MockInviteObject_GetExistingInviteInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// RemoveExistingInviteInfo provides a mock function with given fields:
|
||||
func (_m *MockInviteObject) RemoveExistingInviteInfo() (string, error) {
|
||||
func (_m *MockInviteObject) RemoveExistingInviteInfo() (domain.InviteInfo, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for RemoveExistingInviteInfo")
|
||||
}
|
||||
|
||||
var r0 string
|
||||
var r0 domain.InviteInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func() (string, error)); ok {
|
||||
if rf, ok := ret.Get(0).(func() (domain.InviteInfo, error)); ok {
|
||||
return rf()
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func() string); ok {
|
||||
if rf, ok := ret.Get(0).(func() domain.InviteInfo); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(string)
|
||||
r0 = ret.Get(0).(domain.InviteInfo)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func() error); ok {
|
||||
|
@ -172,12 +165,12 @@ func (_c *MockInviteObject_RemoveExistingInviteInfo_Call) Run(run func()) *MockI
|
|||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInviteObject_RemoveExistingInviteInfo_Call) Return(fileCid string, err error) *MockInviteObject_RemoveExistingInviteInfo_Call {
|
||||
_c.Call.Return(fileCid, err)
|
||||
func (_c *MockInviteObject_RemoveExistingInviteInfo_Call) Return(_a0 domain.InviteInfo, _a1 error) *MockInviteObject_RemoveExistingInviteInfo_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInviteObject_RemoveExistingInviteInfo_Call) RunAndReturn(run func() (string, error)) *MockInviteObject_RemoveExistingInviteInfo_Call {
|
||||
func (_c *MockInviteObject_RemoveExistingInviteInfo_Call) RunAndReturn(run func() (domain.InviteInfo, error)) *MockInviteObject_RemoveExistingInviteInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
@ -229,17 +222,17 @@ func (_c *MockInviteObject_SetGuestInviteFileInfo_Call) RunAndReturn(run func(st
|
|||
return _c
|
||||
}
|
||||
|
||||
// SetInviteFileInfo provides a mock function with given fields: fileCid, fileKey
|
||||
func (_m *MockInviteObject) SetInviteFileInfo(fileCid string, fileKey string) error {
|
||||
ret := _m.Called(fileCid, fileKey)
|
||||
// SetInviteFileInfo provides a mock function with given fields: inviteInfo
|
||||
func (_m *MockInviteObject) SetInviteFileInfo(inviteInfo domain.InviteInfo) error {
|
||||
ret := _m.Called(inviteInfo)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for SetInviteFileInfo")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(string, string) error); ok {
|
||||
r0 = rf(fileCid, fileKey)
|
||||
if rf, ok := ret.Get(0).(func(domain.InviteInfo) error); ok {
|
||||
r0 = rf(inviteInfo)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
@ -253,15 +246,14 @@ type MockInviteObject_SetInviteFileInfo_Call struct {
|
|||
}
|
||||
|
||||
// SetInviteFileInfo is a helper method to define mock.On call
|
||||
// - fileCid string
|
||||
// - fileKey string
|
||||
func (_e *MockInviteObject_Expecter) SetInviteFileInfo(fileCid interface{}, fileKey interface{}) *MockInviteObject_SetInviteFileInfo_Call {
|
||||
return &MockInviteObject_SetInviteFileInfo_Call{Call: _e.mock.On("SetInviteFileInfo", fileCid, fileKey)}
|
||||
// - inviteInfo domain.InviteInfo
|
||||
func (_e *MockInviteObject_Expecter) SetInviteFileInfo(inviteInfo interface{}) *MockInviteObject_SetInviteFileInfo_Call {
|
||||
return &MockInviteObject_SetInviteFileInfo_Call{Call: _e.mock.On("SetInviteFileInfo", inviteInfo)}
|
||||
}
|
||||
|
||||
func (_c *MockInviteObject_SetInviteFileInfo_Call) Run(run func(fileCid string, fileKey string)) *MockInviteObject_SetInviteFileInfo_Call {
|
||||
func (_c *MockInviteObject_SetInviteFileInfo_Call) Run(run func(inviteInfo domain.InviteInfo)) *MockInviteObject_SetInviteFileInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(string))
|
||||
run(args[0].(domain.InviteInfo))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
@ -271,7 +263,7 @@ func (_c *MockInviteObject_SetInviteFileInfo_Call) Return(err error) *MockInvite
|
|||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInviteObject_SetInviteFileInfo_Call) RunAndReturn(run func(string, string) error) *MockInviteObject_SetInviteFileInfo_Call {
|
||||
func (_c *MockInviteObject_SetInviteFileInfo_Call) RunAndReturn(run func(domain.InviteInfo) error) *MockInviteObject_SetInviteFileInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/anyproto/any-sync/app"
|
||||
"github.com/anyproto/any-sync/commonspace/object/acl/list"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
@ -12,14 +13,13 @@ import (
|
|||
"github.com/anyproto/anytype-heart/core/anytype/account/mock_account"
|
||||
"github.com/anyproto/anytype-heart/core/block/editor/smartblock"
|
||||
"github.com/anyproto/anytype-heart/core/block/editor/smartblock/smarttest"
|
||||
"github.com/anyproto/anytype-heart/core/domain"
|
||||
"github.com/anyproto/anytype-heart/core/domain/mock_domain"
|
||||
"github.com/anyproto/anytype-heart/core/files/fileacl/mock_fileacl"
|
||||
"github.com/anyproto/anytype-heart/core/invitestore/mock_invitestore"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/threads"
|
||||
"github.com/anyproto/anytype-heart/space/clientspace"
|
||||
"github.com/anyproto/anytype-heart/space/clientspace/mock_clientspace"
|
||||
"github.com/anyproto/anytype-heart/space/mock_space"
|
||||
"github.com/anyproto/anytype-heart/space/techspace"
|
||||
"github.com/anyproto/anytype-heart/space/techspace/mock_techspace"
|
||||
"github.com/anyproto/anytype-heart/tests/testutil"
|
||||
)
|
||||
|
@ -30,38 +30,9 @@ type mockInviteObject struct {
|
|||
}
|
||||
|
||||
func TestInviteService_GetCurrent(t *testing.T) {
|
||||
t.Run("get current migration", func(t *testing.T) {
|
||||
fx := newFixture(t)
|
||||
defer fx.ctrl.Finish()
|
||||
fx.mockSpaceService.EXPECT().TechSpace().Return(&clientspace.TechSpace{TechSpace: fx.mockTechSpace})
|
||||
fx.mockTechSpace.EXPECT().DoSpaceView(ctx, "spaceId", mock.Anything).RunAndReturn(
|
||||
func(ctx context.Context, spaceId string, f func(view techspace.SpaceView) error) error {
|
||||
return f(fx.mockSpaceView)
|
||||
})
|
||||
fx.mockSpaceView.EXPECT().GetExistingInviteInfo().Return("fileId", "fileKey")
|
||||
fx.mockSpaceView.EXPECT().RemoveExistingInviteInfo().Return("fileId", nil)
|
||||
fx.mockSpaceService.EXPECT().Get(ctx, "spaceId").Return(fx.mockSpace, nil)
|
||||
fx.mockSpace.EXPECT().DerivedIDs().Return(threads.DerivedSmartblockIds{
|
||||
Workspace: "workspaceId",
|
||||
})
|
||||
fx.mockSpace.EXPECT().Do("workspaceId", mock.Anything).RunAndReturn(func(s string, f func(smartblock.SmartBlock) error) error {
|
||||
return f(mockInviteObject{SmartBlock: smarttest.New("root"), MockInviteObject: fx.mockInviteObject})
|
||||
})
|
||||
fx.mockInviteObject.EXPECT().SetInviteFileInfo("fileId", "fileKey").Return(nil)
|
||||
info, err := fx.GetCurrent(ctx, "spaceId")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "fileKey", info.InviteFileKey)
|
||||
require.Equal(t, "fileId", info.InviteFileCid)
|
||||
})
|
||||
t.Run("get current no migration", func(t *testing.T) {
|
||||
fx := newFixture(t)
|
||||
defer fx.ctrl.Finish()
|
||||
fx.mockSpaceService.EXPECT().TechSpace().Return(&clientspace.TechSpace{TechSpace: fx.mockTechSpace})
|
||||
fx.mockTechSpace.EXPECT().DoSpaceView(ctx, "spaceId", mock.Anything).RunAndReturn(
|
||||
func(ctx context.Context, spaceId string, f func(view techspace.SpaceView) error) error {
|
||||
return f(fx.mockSpaceView)
|
||||
})
|
||||
fx.mockSpaceView.EXPECT().GetExistingInviteInfo().Return("", "")
|
||||
fx.mockSpaceService.EXPECT().Get(ctx, "spaceId").Return(fx.mockSpace, nil)
|
||||
fx.mockSpace.EXPECT().DerivedIDs().Return(threads.DerivedSmartblockIds{
|
||||
Workspace: "workspaceId",
|
||||
|
@ -69,11 +40,16 @@ func TestInviteService_GetCurrent(t *testing.T) {
|
|||
fx.mockSpace.EXPECT().Do("workspaceId", mock.Anything).RunAndReturn(func(s string, f func(smartblock.SmartBlock) error) error {
|
||||
return f(mockInviteObject{SmartBlock: smarttest.New("root"), MockInviteObject: fx.mockInviteObject})
|
||||
})
|
||||
fx.mockInviteObject.EXPECT().GetExistingInviteInfo().Return("fileId", "fileKey")
|
||||
returnedInfo := domain.InviteInfo{
|
||||
InviteFileCid: "fileCid",
|
||||
InviteFileKey: "fileKey",
|
||||
InviteType: domain.InviteTypeAnyone,
|
||||
Permissions: list.AclPermissionsWriter,
|
||||
}
|
||||
fx.mockInviteObject.EXPECT().GetExistingInviteInfo().Return(returnedInfo)
|
||||
info, err := fx.GetCurrent(ctx, "spaceId")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "fileKey", info.InviteFileKey)
|
||||
require.Equal(t, "fileId", info.InviteFileCid)
|
||||
require.Equal(t, returnedInfo, info)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,10 @@ import (
|
|||
|
||||
domain "github.com/anyproto/anytype-heart/core/domain"
|
||||
|
||||
inviteservice "github.com/anyproto/anytype-heart/core/inviteservice"
|
||||
|
||||
list "github.com/anyproto/any-sync/commonspace/object/acl/list"
|
||||
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
model "github.com/anyproto/anytype-heart/pkg/lib/pb/model"
|
||||
|
@ -30,6 +34,54 @@ func (_m *MockInviteService) EXPECT() *MockInviteService_Expecter {
|
|||
return &MockInviteService_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// Change provides a mock function with given fields: ctx, spaceId, permissions
|
||||
func (_m *MockInviteService) Change(ctx context.Context, spaceId string, permissions list.AclPermissions) error {
|
||||
ret := _m.Called(ctx, spaceId, permissions)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Change")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, string, list.AclPermissions) error); ok {
|
||||
r0 = rf(ctx, spaceId, permissions)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockInviteService_Change_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Change'
|
||||
type MockInviteService_Change_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Change is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - spaceId string
|
||||
// - permissions list.AclPermissions
|
||||
func (_e *MockInviteService_Expecter) Change(ctx interface{}, spaceId interface{}, permissions interface{}) *MockInviteService_Change_Call {
|
||||
return &MockInviteService_Change_Call{Call: _e.mock.On("Change", ctx, spaceId, permissions)}
|
||||
}
|
||||
|
||||
func (_c *MockInviteService_Change_Call) Run(run func(ctx context.Context, spaceId string, permissions list.AclPermissions)) *MockInviteService_Change_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(string), args[2].(list.AclPermissions))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInviteService_Change_Call) Return(_a0 error) *MockInviteService_Change_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInviteService_Change_Call) RunAndReturn(run func(context.Context, string, list.AclPermissions) error) *MockInviteService_Change_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Close provides a mock function with given fields: ctx
|
||||
func (_m *MockInviteService) Close(ctx context.Context) error {
|
||||
ret := _m.Called(ctx)
|
||||
|
@ -76,9 +128,9 @@ func (_c *MockInviteService_Close_Call) RunAndReturn(run func(context.Context) e
|
|||
return _c
|
||||
}
|
||||
|
||||
// Generate provides a mock function with given fields: ctx, spaceId, inviteKey, sendInvite
|
||||
func (_m *MockInviteService) Generate(ctx context.Context, spaceId string, inviteKey crypto.PrivKey, sendInvite func() error) (domain.InviteInfo, error) {
|
||||
ret := _m.Called(ctx, spaceId, inviteKey, sendInvite)
|
||||
// Generate provides a mock function with given fields: ctx, params, sendInvite
|
||||
func (_m *MockInviteService) Generate(ctx context.Context, params inviteservice.GenerateInviteParams, sendInvite func() error) (domain.InviteInfo, error) {
|
||||
ret := _m.Called(ctx, params, sendInvite)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for Generate")
|
||||
|
@ -86,17 +138,17 @@ func (_m *MockInviteService) Generate(ctx context.Context, spaceId string, invit
|
|||
|
||||
var r0 domain.InviteInfo
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, string, crypto.PrivKey, func() error) (domain.InviteInfo, error)); ok {
|
||||
return rf(ctx, spaceId, inviteKey, sendInvite)
|
||||
if rf, ok := ret.Get(0).(func(context.Context, inviteservice.GenerateInviteParams, func() error) (domain.InviteInfo, error)); ok {
|
||||
return rf(ctx, params, sendInvite)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(context.Context, string, crypto.PrivKey, func() error) domain.InviteInfo); ok {
|
||||
r0 = rf(ctx, spaceId, inviteKey, sendInvite)
|
||||
if rf, ok := ret.Get(0).(func(context.Context, inviteservice.GenerateInviteParams, func() error) domain.InviteInfo); ok {
|
||||
r0 = rf(ctx, params, sendInvite)
|
||||
} else {
|
||||
r0 = ret.Get(0).(domain.InviteInfo)
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(context.Context, string, crypto.PrivKey, func() error) error); ok {
|
||||
r1 = rf(ctx, spaceId, inviteKey, sendInvite)
|
||||
if rf, ok := ret.Get(1).(func(context.Context, inviteservice.GenerateInviteParams, func() error) error); ok {
|
||||
r1 = rf(ctx, params, sendInvite)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
@ -111,16 +163,15 @@ type MockInviteService_Generate_Call struct {
|
|||
|
||||
// Generate is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - spaceId string
|
||||
// - inviteKey crypto.PrivKey
|
||||
// - params inviteservice.GenerateInviteParams
|
||||
// - sendInvite func() error
|
||||
func (_e *MockInviteService_Expecter) Generate(ctx interface{}, spaceId interface{}, inviteKey interface{}, sendInvite interface{}) *MockInviteService_Generate_Call {
|
||||
return &MockInviteService_Generate_Call{Call: _e.mock.On("Generate", ctx, spaceId, inviteKey, sendInvite)}
|
||||
func (_e *MockInviteService_Expecter) Generate(ctx interface{}, params interface{}, sendInvite interface{}) *MockInviteService_Generate_Call {
|
||||
return &MockInviteService_Generate_Call{Call: _e.mock.On("Generate", ctx, params, sendInvite)}
|
||||
}
|
||||
|
||||
func (_c *MockInviteService_Generate_Call) Run(run func(ctx context.Context, spaceId string, inviteKey crypto.PrivKey, sendInvite func() error)) *MockInviteService_Generate_Call {
|
||||
func (_c *MockInviteService_Generate_Call) Run(run func(ctx context.Context, params inviteservice.GenerateInviteParams, sendInvite func() error)) *MockInviteService_Generate_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(string), args[2].(crypto.PrivKey), args[3].(func() error))
|
||||
run(args[0].(context.Context), args[1].(inviteservice.GenerateInviteParams), args[2].(func() error))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
@ -130,7 +181,7 @@ func (_c *MockInviteService_Generate_Call) Return(_a0 domain.InviteInfo, _a1 err
|
|||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockInviteService_Generate_Call) RunAndReturn(run func(context.Context, string, crypto.PrivKey, func() error) (domain.InviteInfo, error)) *MockInviteService_Generate_Call {
|
||||
func (_c *MockInviteService_Generate_Call) RunAndReturn(run func(context.Context, inviteservice.GenerateInviteParams, func() error) (domain.InviteInfo, error)) *MockInviteService_Generate_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
|
2
go.mod
2
go.mod
|
@ -8,7 +8,7 @@ require (
|
|||
github.com/VividCortex/ewma v1.2.0
|
||||
github.com/adrium/goheif v0.0.0-20230113233934-ca402e77a786
|
||||
github.com/anyproto/any-store v0.2.0
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250515080349-03fd12ac2a3e
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250515110754-b8a877201bb5
|
||||
github.com/anyproto/anytype-publish-server/publishclient v0.0.0-20250131145601-de288583ff2a
|
||||
github.com/anyproto/anytype-push-server/pushclient v0.0.0-20250402124745-6451298047f7
|
||||
github.com/anyproto/go-chash v0.1.0
|
||||
|
|
10
go.sum
10
go.sum
|
@ -80,14 +80,8 @@ github.com/andybalholm/cascadia v1.3.3 h1:AG2YHrzJIm4BZ19iwJ/DAua6Btl3IwJX+VI4kk
|
|||
github.com/andybalholm/cascadia v1.3.3/go.mod h1:xNd9bqTn98Ln4DwST8/nG+H0yuB8Hmgu1YHNnWw0GeA=
|
||||
github.com/anyproto/any-store v0.2.0 h1:M8Eb0dxuEk62lIGZ3k1nADlaPQzmo6ilWLCCcY9WX10=
|
||||
github.com/anyproto/any-store v0.2.0/go.mod h1:N59OGYe/uXRNpr6ytfbBpbC+1viDgSbsVNXevOMxJAM=
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250512200224-c2de5ecb12c0 h1:ZS9++jR+3NCP5MK/aBy/McoyLiwsBzA7jwMDI15+b9o=
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250512200224-c2de5ecb12c0/go.mod h1:G6i3PT6pN6lcC5rim5Ed7ppUPuQgU5PyHgiqskrggL0=
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250513132905-854823d81e74 h1:Io1SWrvvWjnXjtJsNvRcfvv52U6H7DAHLHcpkm8Vo7A=
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250513132905-854823d81e74/go.mod h1:G6i3PT6pN6lcC5rim5Ed7ppUPuQgU5PyHgiqskrggL0=
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250513194226-2f661565dcca h1:DXXRxTfKBA8q22wCDvng182WjRjeAQqmGaZs/hXdMyo=
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250513194226-2f661565dcca/go.mod h1:G6i3PT6pN6lcC5rim5Ed7ppUPuQgU5PyHgiqskrggL0=
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250515080349-03fd12ac2a3e h1:FIZDZYAVB5ZJOKZZI9cJYcfKeyH51MEOLTqbVC809Js=
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250515080349-03fd12ac2a3e/go.mod h1:G6i3PT6pN6lcC5rim5Ed7ppUPuQgU5PyHgiqskrggL0=
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250515110754-b8a877201bb5 h1:DIMKHkMzoGMf50y2s3qHj19JiXgQE7+1EbFnNUaYp/s=
|
||||
github.com/anyproto/any-sync v0.7.6-0.20250515110754-b8a877201bb5/go.mod h1:G6i3PT6pN6lcC5rim5Ed7ppUPuQgU5PyHgiqskrggL0=
|
||||
github.com/anyproto/anytype-publish-server/publishclient v0.0.0-20250131145601-de288583ff2a h1:ZZM+0OUCQMWSLSflpkf0ZMVo3V76qEDDIXPpQOClNs0=
|
||||
github.com/anyproto/anytype-publish-server/publishclient v0.0.0-20250131145601-de288583ff2a/go.mod h1:4fkueCZcGniSMXkrwESO8zzERrh/L7WHimRNWecfGM0=
|
||||
github.com/anyproto/anytype-push-server/pushclient v0.0.0-20250402124745-6451298047f7 h1:oKkEnxnN1jeB1Ty20CTMH3w4WkCrV8dOQy1Myetg7XA=
|
||||
|
|
|
@ -632,6 +632,54 @@ func (_c *MockService_Init_Call) RunAndReturn(run func(*app.App) error) *MockSer
|
|||
return _c
|
||||
}
|
||||
|
||||
// InviteJoin provides a mock function with given fields: ctx, id, aclHeadId
|
||||
func (_m *MockService) InviteJoin(ctx context.Context, id string, aclHeadId string) error {
|
||||
ret := _m.Called(ctx, id, aclHeadId)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for InviteJoin")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
|
||||
r0 = rf(ctx, id, aclHeadId)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockService_InviteJoin_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InviteJoin'
|
||||
type MockService_InviteJoin_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// InviteJoin is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - id string
|
||||
// - aclHeadId string
|
||||
func (_e *MockService_Expecter) InviteJoin(ctx interface{}, id interface{}, aclHeadId interface{}) *MockService_InviteJoin_Call {
|
||||
return &MockService_InviteJoin_Call{Call: _e.mock.On("InviteJoin", ctx, id, aclHeadId)}
|
||||
}
|
||||
|
||||
func (_c *MockService_InviteJoin_Call) Run(run func(ctx context.Context, id string, aclHeadId string)) *MockService_InviteJoin_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(string), args[2].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_InviteJoin_Call) Return(_a0 error) *MockService_InviteJoin_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockService_InviteJoin_Call) RunAndReturn(run func(context.Context, string, string) error) *MockService_InviteJoin_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Join provides a mock function with given fields: ctx, id, aclHeadId
|
||||
func (_m *MockService) Join(ctx context.Context, id string, aclHeadId string) error {
|
||||
ret := _m.Called(ctx, id, aclHeadId)
|
||||
|
|
|
@ -30,6 +30,66 @@ func (_m *MockSpaceFactory) EXPECT() *MockSpaceFactory_Expecter {
|
|||
return &MockSpaceFactory_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// CreateActiveSpace provides a mock function with given fields: ctx, id, aclHeadId
|
||||
func (_m *MockSpaceFactory) CreateActiveSpace(ctx context.Context, id string, aclHeadId string) (spacecontroller.SpaceController, error) {
|
||||
ret := _m.Called(ctx, id, aclHeadId)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for CreateActiveSpace")
|
||||
}
|
||||
|
||||
var r0 spacecontroller.SpaceController
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, string, string) (spacecontroller.SpaceController, error)); ok {
|
||||
return rf(ctx, id, aclHeadId)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(context.Context, string, string) spacecontroller.SpaceController); ok {
|
||||
r0 = rf(ctx, id, aclHeadId)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(spacecontroller.SpaceController)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
|
||||
r1 = rf(ctx, id, aclHeadId)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockSpaceFactory_CreateActiveSpace_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateActiveSpace'
|
||||
type MockSpaceFactory_CreateActiveSpace_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// CreateActiveSpace is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - id string
|
||||
// - aclHeadId string
|
||||
func (_e *MockSpaceFactory_Expecter) CreateActiveSpace(ctx interface{}, id interface{}, aclHeadId interface{}) *MockSpaceFactory_CreateActiveSpace_Call {
|
||||
return &MockSpaceFactory_CreateActiveSpace_Call{Call: _e.mock.On("CreateActiveSpace", ctx, id, aclHeadId)}
|
||||
}
|
||||
|
||||
func (_c *MockSpaceFactory_CreateActiveSpace_Call) Run(run func(ctx context.Context, id string, aclHeadId string)) *MockSpaceFactory_CreateActiveSpace_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(string), args[2].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSpaceFactory_CreateActiveSpace_Call) Return(sp spacecontroller.SpaceController, err error) *MockSpaceFactory_CreateActiveSpace_Call {
|
||||
_c.Call.Return(sp, err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSpaceFactory_CreateActiveSpace_Call) RunAndReturn(run func(context.Context, string, string) (spacecontroller.SpaceController, error)) *MockSpaceFactory_CreateActiveSpace_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// CreateAndSetTechSpace provides a mock function with given fields: ctx
|
||||
func (_m *MockSpaceFactory) CreateAndSetTechSpace(ctx context.Context) (*clientspace.TechSpace, error) {
|
||||
ret := _m.Called(ctx)
|
||||
|
|
|
@ -22,61 +22,6 @@ func (_m *MockSpaceView) EXPECT() *MockSpaceView_Expecter {
|
|||
return &MockSpaceView_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// GetExistingInviteInfo provides a mock function with given fields:
|
||||
func (_m *MockSpaceView) GetExistingInviteInfo() (string, string) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetExistingInviteInfo")
|
||||
}
|
||||
|
||||
var r0 string
|
||||
var r1 string
|
||||
if rf, ok := ret.Get(0).(func() (string, string)); 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() string); ok {
|
||||
r1 = rf()
|
||||
} else {
|
||||
r1 = ret.Get(1).(string)
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// MockSpaceView_GetExistingInviteInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetExistingInviteInfo'
|
||||
type MockSpaceView_GetExistingInviteInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetExistingInviteInfo is a helper method to define mock.On call
|
||||
func (_e *MockSpaceView_Expecter) GetExistingInviteInfo() *MockSpaceView_GetExistingInviteInfo_Call {
|
||||
return &MockSpaceView_GetExistingInviteInfo_Call{Call: _e.mock.On("GetExistingInviteInfo")}
|
||||
}
|
||||
|
||||
func (_c *MockSpaceView_GetExistingInviteInfo_Call) Run(run func()) *MockSpaceView_GetExistingInviteInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSpaceView_GetExistingInviteInfo_Call) Return(fileCid string, fileKey string) *MockSpaceView_GetExistingInviteInfo_Call {
|
||||
_c.Call.Return(fileCid, fileKey)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSpaceView_GetExistingInviteInfo_Call) RunAndReturn(run func() (string, string)) *MockSpaceView_GetExistingInviteInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetLocalInfo provides a mock function with given fields:
|
||||
func (_m *MockSpaceView) GetLocalInfo() spaceinfo.SpaceLocalInfo {
|
||||
ret := _m.Called()
|
||||
|
@ -289,61 +234,6 @@ func (_c *MockSpaceView_Lock_Call) RunAndReturn(run func()) *MockSpaceView_Lock_
|
|||
return _c
|
||||
}
|
||||
|
||||
// RemoveExistingInviteInfo provides a mock function with given fields:
|
||||
func (_m *MockSpaceView) RemoveExistingInviteInfo() (string, error) {
|
||||
ret := _m.Called()
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for RemoveExistingInviteInfo")
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
// MockSpaceView_RemoveExistingInviteInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveExistingInviteInfo'
|
||||
type MockSpaceView_RemoveExistingInviteInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// RemoveExistingInviteInfo is a helper method to define mock.On call
|
||||
func (_e *MockSpaceView_Expecter) RemoveExistingInviteInfo() *MockSpaceView_RemoveExistingInviteInfo_Call {
|
||||
return &MockSpaceView_RemoveExistingInviteInfo_Call{Call: _e.mock.On("RemoveExistingInviteInfo")}
|
||||
}
|
||||
|
||||
func (_c *MockSpaceView_RemoveExistingInviteInfo_Call) Run(run func()) *MockSpaceView_RemoveExistingInviteInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSpaceView_RemoveExistingInviteInfo_Call) Return(fileCid string, err error) *MockSpaceView_RemoveExistingInviteInfo_Call {
|
||||
_c.Call.Return(fileCid, err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSpaceView_RemoveExistingInviteInfo_Call) RunAndReturn(run func() (string, error)) *MockSpaceView_RemoveExistingInviteInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetAccessType provides a mock function with given fields: acc
|
||||
func (_m *MockSpaceView) SetAccessType(acc spaceinfo.AccessType) error {
|
||||
ret := _m.Called(acc)
|
||||
|
@ -436,53 +326,6 @@ func (_c *MockSpaceView_SetAclIsEmpty_Call) RunAndReturn(run func(bool) error) *
|
|||
return _c
|
||||
}
|
||||
|
||||
// SetInviteFileInfo provides a mock function with given fields: fileCid, fileKey
|
||||
func (_m *MockSpaceView) SetInviteFileInfo(fileCid string, fileKey string) error {
|
||||
ret := _m.Called(fileCid, fileKey)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for SetInviteFileInfo")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(string, string) error); ok {
|
||||
r0 = rf(fileCid, fileKey)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// MockSpaceView_SetInviteFileInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetInviteFileInfo'
|
||||
type MockSpaceView_SetInviteFileInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SetInviteFileInfo is a helper method to define mock.On call
|
||||
// - fileCid string
|
||||
// - fileKey string
|
||||
func (_e *MockSpaceView_Expecter) SetInviteFileInfo(fileCid interface{}, fileKey interface{}) *MockSpaceView_SetInviteFileInfo_Call {
|
||||
return &MockSpaceView_SetInviteFileInfo_Call{Call: _e.mock.On("SetInviteFileInfo", fileCid, fileKey)}
|
||||
}
|
||||
|
||||
func (_c *MockSpaceView_SetInviteFileInfo_Call) Run(run func(fileCid string, fileKey string)) *MockSpaceView_SetInviteFileInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSpaceView_SetInviteFileInfo_Call) Return(err error) *MockSpaceView_SetInviteFileInfo_Call {
|
||||
_c.Call.Return(err)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *MockSpaceView_SetInviteFileInfo_Call) RunAndReturn(run func(string, string) error) *MockSpaceView_SetInviteFileInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetOwner provides a mock function with given fields: ownerId, createdDate
|
||||
func (_m *MockSpaceView) SetOwner(ownerId string, createdDate int64) error {
|
||||
ret := _m.Called(ownerId, createdDate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue