mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
* [MM-69366] Scope property field lookups by object type Add GetFieldByNameForObjectType and route the access-control attribute lookups through it, so a user custom profile attribute is no longer confused with the internal classification fields that share its name. Deprecate the name-only GetFieldByName (kept only for the plugin API) and move internal callers onto the scoped variant. * Add test store mock expectations for GetFieldByNameForObjectType The startup migrations now look up fields via the scoped method, so the testlib mock store needs matching expectations — notably the managed category field, whose ID is cached at startup. * Fix store test to create valid PSAv2 property fields Setting ObjectType makes a field PSAv2, which requires a valid target type, so the test fields now use the system target level (with an empty target ID) instead of an unset target type. --------- Co-authored-by: Hanzo Dev <[email protected]>
430 lines
12 KiB
Go
430 lines
12 KiB
Go
// Code generated by mockery v2.53.4. DO NOT EDIT.
|
|
|
|
// Regenerate this file using `make store-mocks`.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
context "context"
|
|
|
|
model "github.com/mattermost/mattermost/server/public/model"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// PropertyFieldStore is an autogenerated mock type for the PropertyFieldStore type
|
|
type PropertyFieldStore struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// CheckPropertyNameConflict provides a mock function with given fields: field, excludeID
|
|
func (_m *PropertyFieldStore) CheckPropertyNameConflict(field *model.PropertyField, excludeID string) (model.PropertyFieldTargetLevel, error) {
|
|
ret := _m.Called(field, excludeID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CheckPropertyNameConflict")
|
|
}
|
|
|
|
var r0 model.PropertyFieldTargetLevel
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(*model.PropertyField, string) (model.PropertyFieldTargetLevel, error)); ok {
|
|
return rf(field, excludeID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(*model.PropertyField, string) model.PropertyFieldTargetLevel); ok {
|
|
r0 = rf(field, excludeID)
|
|
} else {
|
|
r0 = ret.Get(0).(model.PropertyFieldTargetLevel)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(*model.PropertyField, string) error); ok {
|
|
r1 = rf(field, excludeID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CountForGroup provides a mock function with given fields: groupID, includeDeleted
|
|
func (_m *PropertyFieldStore) CountForGroup(groupID string, includeDeleted bool) (int64, error) {
|
|
ret := _m.Called(groupID, includeDeleted)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CountForGroup")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, bool) (int64, error)); ok {
|
|
return rf(groupID, includeDeleted)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, bool) int64); ok {
|
|
r0 = rf(groupID, includeDeleted)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, bool) error); ok {
|
|
r1 = rf(groupID, includeDeleted)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CountForGroupObjectType provides a mock function with given fields: groupID, objectType, includeDeleted
|
|
func (_m *PropertyFieldStore) CountForGroupObjectType(groupID string, objectType string, includeDeleted bool) (int64, error) {
|
|
ret := _m.Called(groupID, objectType, includeDeleted)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CountForGroupObjectType")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, string, bool) (int64, error)); ok {
|
|
return rf(groupID, objectType, includeDeleted)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string, bool) int64); ok {
|
|
r0 = rf(groupID, objectType, includeDeleted)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string, bool) error); ok {
|
|
r1 = rf(groupID, objectType, includeDeleted)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CountForTarget provides a mock function with given fields: groupID, targetType, targetID, includeDeleted
|
|
func (_m *PropertyFieldStore) CountForTarget(groupID string, targetType string, targetID string, includeDeleted bool) (int64, error) {
|
|
ret := _m.Called(groupID, targetType, targetID, includeDeleted)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CountForTarget")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, string, string, bool) (int64, error)); ok {
|
|
return rf(groupID, targetType, targetID, includeDeleted)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string, string, bool) int64); ok {
|
|
r0 = rf(groupID, targetType, targetID, includeDeleted)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string, string, bool) error); ok {
|
|
r1 = rf(groupID, targetType, targetID, includeDeleted)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CountLinkedFields provides a mock function with given fields: fieldID
|
|
func (_m *PropertyFieldStore) CountLinkedFields(fieldID string) (int64, error) {
|
|
ret := _m.Called(fieldID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CountLinkedFields")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string) (int64, error)); ok {
|
|
return rf(fieldID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) int64); ok {
|
|
r0 = rf(fieldID)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
|
r1 = rf(fieldID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Create provides a mock function with given fields: field
|
|
func (_m *PropertyFieldStore) Create(field *model.PropertyField) (*model.PropertyField, error) {
|
|
ret := _m.Called(field)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Create")
|
|
}
|
|
|
|
var r0 *model.PropertyField
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(*model.PropertyField) (*model.PropertyField, error)); ok {
|
|
return rf(field)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(*model.PropertyField) *model.PropertyField); ok {
|
|
r0 = rf(field)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(*model.PropertyField) error); ok {
|
|
r1 = rf(field)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: groupID, id
|
|
func (_m *PropertyFieldStore) Delete(groupID string, id string) error {
|
|
ret := _m.Called(groupID, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Delete")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, string) error); ok {
|
|
r0 = rf(groupID, id)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Get provides a mock function with given fields: ctx, groupID, id
|
|
func (_m *PropertyFieldStore) Get(ctx context.Context, groupID string, id string) (*model.PropertyField, error) {
|
|
ret := _m.Called(ctx, groupID, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Get")
|
|
}
|
|
|
|
var r0 *model.PropertyField
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string) (*model.PropertyField, error)); ok {
|
|
return rf(ctx, groupID, id)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string) *model.PropertyField); ok {
|
|
r0 = rf(ctx, groupID, id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
|
|
r1 = rf(ctx, groupID, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetFieldByName provides a mock function with given fields: ctx, groupID, targetID, name
|
|
func (_m *PropertyFieldStore) GetFieldByName(ctx context.Context, groupID string, targetID string, name string) (*model.PropertyField, error) {
|
|
ret := _m.Called(ctx, groupID, targetID, name)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetFieldByName")
|
|
}
|
|
|
|
var r0 *model.PropertyField
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, string) (*model.PropertyField, error)); ok {
|
|
return rf(ctx, groupID, targetID, name)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, string) *model.PropertyField); ok {
|
|
r0 = rf(ctx, groupID, targetID, name)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string, string) error); ok {
|
|
r1 = rf(ctx, groupID, targetID, name)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetFieldByNameForObjectType provides a mock function with given fields: ctx, groupID, targetID, objectType, name
|
|
func (_m *PropertyFieldStore) GetFieldByNameForObjectType(ctx context.Context, groupID string, targetID string, objectType string, name string) (*model.PropertyField, error) {
|
|
ret := _m.Called(ctx, groupID, targetID, objectType, name)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetFieldByNameForObjectType")
|
|
}
|
|
|
|
var r0 *model.PropertyField
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string) (*model.PropertyField, error)); ok {
|
|
return rf(ctx, groupID, targetID, objectType, name)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string) *model.PropertyField); ok {
|
|
r0 = rf(ctx, groupID, targetID, objectType, name)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string) error); ok {
|
|
r1 = rf(ctx, groupID, targetID, objectType, name)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetForGroup provides a mock function with given fields: ctx, groupID
|
|
func (_m *PropertyFieldStore) GetForGroup(ctx context.Context, groupID string) ([]*model.PropertyField, error) {
|
|
ret := _m.Called(ctx, groupID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetForGroup")
|
|
}
|
|
|
|
var r0 []*model.PropertyField
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) ([]*model.PropertyField, error)); ok {
|
|
return rf(ctx, groupID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) []*model.PropertyField); ok {
|
|
r0 = rf(ctx, groupID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, groupID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetMany provides a mock function with given fields: ctx, groupID, ids
|
|
func (_m *PropertyFieldStore) GetMany(ctx context.Context, groupID string, ids []string) ([]*model.PropertyField, error) {
|
|
ret := _m.Called(ctx, groupID, ids)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetMany")
|
|
}
|
|
|
|
var r0 []*model.PropertyField
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, []string) ([]*model.PropertyField, error)); ok {
|
|
return rf(ctx, groupID, ids)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, []string) []*model.PropertyField); ok {
|
|
r0 = rf(ctx, groupID, ids)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, []string) error); ok {
|
|
r1 = rf(ctx, groupID, ids)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// SearchPropertyFields provides a mock function with given fields: opts
|
|
func (_m *PropertyFieldStore) SearchPropertyFields(opts model.PropertyFieldSearchOpts) ([]*model.PropertyField, error) {
|
|
ret := _m.Called(opts)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for SearchPropertyFields")
|
|
}
|
|
|
|
var r0 []*model.PropertyField
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(model.PropertyFieldSearchOpts) ([]*model.PropertyField, error)); ok {
|
|
return rf(opts)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(model.PropertyFieldSearchOpts) []*model.PropertyField); ok {
|
|
r0 = rf(opts)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(model.PropertyFieldSearchOpts) error); ok {
|
|
r1 = rf(opts)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Update provides a mock function with given fields: groupID, fields, expectedUpdateAts
|
|
func (_m *PropertyFieldStore) Update(groupID string, fields []*model.PropertyField, expectedUpdateAts map[string]int64) ([]*model.PropertyField, error) {
|
|
ret := _m.Called(groupID, fields, expectedUpdateAts)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Update")
|
|
}
|
|
|
|
var r0 []*model.PropertyField
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, []*model.PropertyField, map[string]int64) ([]*model.PropertyField, error)); ok {
|
|
return rf(groupID, fields, expectedUpdateAts)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, []*model.PropertyField, map[string]int64) []*model.PropertyField); ok {
|
|
r0 = rf(groupID, fields, expectedUpdateAts)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, []*model.PropertyField, map[string]int64) error); ok {
|
|
r1 = rf(groupID, fields, expectedUpdateAts)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// NewPropertyFieldStore creates a new instance of PropertyFieldStore. 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 NewPropertyFieldStore(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *PropertyFieldStore {
|
|
mock := &PropertyFieldStore{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|