mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
* Implement property field limit enforcement and counting functionality in Plugin API - Added a limit of 20 property fields per group in the CreatePropertyField method. - Introduced CountPropertyFields method to count active and all property fields, including deleted ones. - Enhanced tests to validate the new property field limit and counting behavior. - Updated related API and service methods to support the new functionality. * Update server/channels/app/properties/property_field.go * fix vet * fix lint error * fix test * fix tests * fix test * count properties + targets * Update server/channels/app/plugin_api.go * remove test for limit * fix more tests * improve testing messages now that the limit is removed * Apply suggestion from @calebroseland Co-authored-by: Caleb Roseland <[email protected]> * Apply suggestion from @calebroseland Co-authored-by: Caleb Roseland <[email protected]> * Apply suggestion from @calebroseland Co-authored-by: Caleb Roseland <[email protected]> * Apply suggestion from @calebroseland Co-authored-by: Caleb Roseland <[email protected]> --------- Co-authored-by: Mattermost Build <[email protected]> Co-authored-by: Julien Tant <[email protected]> Co-authored-by: Caleb Roseland <[email protected]> Co-authored-by: Hanzo Dev <[email protected]>
284 lines
7.4 KiB
Go
284 lines
7.4 KiB
Go
// Code generated by mockery v2.53.4. DO NOT EDIT.
|
|
|
|
// Regenerate this file using `make store-mocks`.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
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
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
// 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: groupID, id
|
|
func (_m *PropertyFieldStore) Get(groupID string, id string) (*model.PropertyField, error) {
|
|
ret := _m.Called(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(string, string) (*model.PropertyField, error)); ok {
|
|
return rf(groupID, id)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string) *model.PropertyField); ok {
|
|
r0 = rf(groupID, id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string) error); ok {
|
|
r1 = rf(groupID, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetFieldByName provides a mock function with given fields: groupID, targetID, name
|
|
func (_m *PropertyFieldStore) GetFieldByName(groupID string, targetID string, name string) (*model.PropertyField, error) {
|
|
ret := _m.Called(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(string, string, string) (*model.PropertyField, error)); ok {
|
|
return rf(groupID, targetID, name)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string, string) *model.PropertyField); ok {
|
|
r0 = rf(groupID, targetID, name)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string, string) error); ok {
|
|
r1 = rf(groupID, targetID, name)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetMany provides a mock function with given fields: groupID, ids
|
|
func (_m *PropertyFieldStore) GetMany(groupID string, ids []string) ([]*model.PropertyField, error) {
|
|
ret := _m.Called(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(string, []string) ([]*model.PropertyField, error)); ok {
|
|
return rf(groupID, ids)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, []string) []*model.PropertyField); ok {
|
|
r0 = rf(groupID, ids)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, []string) error); ok {
|
|
r1 = rf(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
|
|
func (_m *PropertyFieldStore) Update(groupID string, fields []*model.PropertyField) ([]*model.PropertyField, error) {
|
|
ret := _m.Called(groupID, fields)
|
|
|
|
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) ([]*model.PropertyField, error)); ok {
|
|
return rf(groupID, fields)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, []*model.PropertyField) []*model.PropertyField); ok {
|
|
r0 = rf(groupID, fields)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.PropertyField)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, []*model.PropertyField) error); ok {
|
|
r1 = rf(groupID, fields)
|
|
} 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
|
|
}
|