@@ -545,11 +545,12 @@ func testGroupStoreGetByUser(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
require.NoError(t, err)
|
||||
|
||||
g2 := &model.Group{
|
||||
Name: model.NewPointer(model.NewId()),
|
||||
DisplayName: model.NewId(),
|
||||
Description: model.NewId(),
|
||||
Source: model.GroupSourceLdap,
|
||||
RemoteId: model.NewPointer(model.NewId()),
|
||||
Name: model.NewPointer(model.NewId()),
|
||||
DisplayName: model.NewId(),
|
||||
Description: model.NewId(),
|
||||
Source: model.GroupSourceLdap,
|
||||
RemoteId: model.NewPointer(model.NewId()),
|
||||
AllowReference: true,
|
||||
}
|
||||
g2, err = ss.Group().Create(g2)
|
||||
require.NoError(t, err)
|
||||
@@ -576,7 +577,7 @@ func testGroupStoreGetByUser(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
_, err = ss.Group().UpsertMember(g2.Id, u2.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
groups, err := ss.Group().GetByUser(u1.Id)
|
||||
groups, err := ss.Group().GetByUser(u1.Id, model.GroupSearchOpts{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, len(groups))
|
||||
found1 := false
|
||||
@@ -592,14 +593,19 @@ func testGroupStoreGetByUser(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
assert.True(t, found1)
|
||||
assert.True(t, found2)
|
||||
|
||||
groups, err = ss.Group().GetByUser(u2.Id)
|
||||
groups, err = ss.Group().GetByUser(u2.Id, model.GroupSearchOpts{})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, len(groups))
|
||||
assert.Equal(t, g2.Id, groups[0].Id)
|
||||
|
||||
groups, err = ss.Group().GetByUser(model.NewId())
|
||||
groups, err = ss.Group().GetByUser(model.NewId(), model.GroupSearchOpts{})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 0, len(groups))
|
||||
|
||||
groups, err = ss.Group().GetByUser(u1.Id, model.GroupSearchOpts{FilterAllowReference: true})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(groups))
|
||||
assert.Equal(t, g2.Id, groups[0].Id)
|
||||
}
|
||||
|
||||
func testGroupStoreUpdate(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
|
||||
@@ -692,9 +692,9 @@ func (_m *GroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSour
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetByUser provides a mock function with given fields: userID
|
||||
func (_m *GroupStore) GetByUser(userID string) ([]*model.Group, error) {
|
||||
ret := _m.Called(userID)
|
||||
// GetByUser provides a mock function with given fields: userID, opts
|
||||
func (_m *GroupStore) GetByUser(userID string, opts model.GroupSearchOpts) ([]*model.Group, error) {
|
||||
ret := _m.Called(userID, opts)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetByUser")
|
||||
@@ -702,19 +702,19 @@ func (_m *GroupStore) GetByUser(userID string) ([]*model.Group, error) {
|
||||
|
||||
var r0 []*model.Group
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(string) ([]*model.Group, error)); ok {
|
||||
return rf(userID)
|
||||
if rf, ok := ret.Get(0).(func(string, model.GroupSearchOpts) ([]*model.Group, error)); ok {
|
||||
return rf(userID, opts)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string) []*model.Group); ok {
|
||||
r0 = rf(userID)
|
||||
if rf, ok := ret.Get(0).(func(string, model.GroupSearchOpts) []*model.Group); ok {
|
||||
r0 = rf(userID, opts)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*model.Group)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string) error); ok {
|
||||
r1 = rf(userID)
|
||||
if rf, ok := ret.Get(1).(func(string, model.GroupSearchOpts) error); ok {
|
||||
r1 = rf(userID, opts)
|
||||
} else {
|
||||
r1 = ret.Error(1)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user