Expose public/ API as submodule (#23345)

* model -> public/model

* plugin -> public/plugin

* public/model/utils -> public/utils

* platform/shared/mlog -> public/shared/mlog

* platform/shared/i18n -> public/shared/i18n

* platform/shared/markdown -> public/shared/markdown

* platform/services/timezones -> public/shared/timezones

* channels/einterfaces -> einterfaces

* expose public/ submodule

* go mod tidy

* .github: cache-dependency-path, setup-go-work

* modules-tidy for public/ too

* remove old gomodtidy
Этот коммит содержится в:
Jesse Hallam
2023-05-10 13:07:02 -03:00
коммит произвёл GitHub
родитель 070ee26081
Коммит bb02b35048
1378 изменённых файлов: 2270 добавлений и 1868 удалений

13
server/einterfaces/account_migration.go Обычный файл
Просмотреть файл

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type AccountMigrationInterface interface {
MigrateToLdap(fromAuthService string, foreignUserFieldNameToMatch string, force bool, dryRun bool) *model.AppError
MigrateToSaml(fromAuthService string, usersMap map[string]string, auto bool, dryRun bool) *model.AppError
}

55
server/einterfaces/cloud.go Обычный файл
Просмотреть файл

@@ -0,0 +1,55 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type CloudInterface interface {
GetCloudProduct(userID string, productID string) (*model.Product, error)
GetCloudProducts(userID string, includeLegacyProducts bool) ([]*model.Product, error)
GetSelfHostedProducts(userID string) ([]*model.Product, error)
GetCloudLimits(userID string) (*model.ProductLimits, error)
CreateCustomerPayment(userID string) (*model.StripeSetupIntent, error)
ConfirmCustomerPayment(userID string, confirmRequest *model.ConfirmPaymentMethodRequest) error
GetCloudCustomer(userID string) (*model.CloudCustomer, error)
GetLicenseSelfServeStatus(userID string, token string) (*model.SubscriptionLicenseSelfServeStatusResponse, error)
UpdateCloudCustomer(userID string, customerInfo *model.CloudCustomerInfo) (*model.CloudCustomer, error)
UpdateCloudCustomerAddress(userID string, address *model.Address) (*model.CloudCustomer, error)
GetSubscription(userID string) (*model.Subscription, error)
GetInvoicesForSubscription(userID string) ([]*model.Invoice, error)
GetInvoicePDF(userID, invoiceID string) ([]byte, string, error)
ChangeSubscription(userID, subscriptionID string, subscriptionChange *model.SubscriptionChange) (*model.Subscription, error)
RequestCloudTrial(userID, subscriptionID, newValidBusinessEmail string) (*model.Subscription, error)
ValidateBusinessEmail(userID, email string) error
InvalidateCaches() error
// hosted customer methods
SelfHostedSignupAvailable() error
BootstrapSelfHostedSignup(req model.BootstrapSelfHostedSignupRequest) (*model.BootstrapSelfHostedSignupResponse, error)
CreateCustomerSelfHostedSignup(req model.SelfHostedCustomerForm, requesterEmail string) (*model.SelfHostedSignupCustomerResponse, error)
ConfirmSelfHostedSignup(req model.SelfHostedConfirmPaymentMethodRequest, requesterEmail string) (*model.SelfHostedSignupConfirmResponse, error)
ConfirmSelfHostedExpansion(req model.SelfHostedConfirmPaymentMethodRequest, requesterEmail string) (*model.SelfHostedSignupConfirmResponse, error)
ConfirmSelfHostedSignupLicenseApplication() error
GetSelfHostedInvoices() ([]*model.Invoice, error)
GetSelfHostedInvoicePDF(invoiceID string) ([]byte, string, error)
CreateOrUpdateSubscriptionHistoryEvent(userID string, userCount int) (*model.SubscriptionHistory, error)
HandleLicenseChange() error
CheckCWSConnection(userId string) error
SelfServeDeleteWorkspace(userID string, deletionRequest *model.WorkspaceDeletionRequest) error
SubscribeToNewsletter(userID string, req *model.SubscribeNewsletterRequest) error
// Used only for when a customer has telemetry disabled. In this scenario, true up review telemetry will be submitted via CWS.
SubmitTrueUpReview(userID string, trueUpReviewProfile map[string]any) error
}

32
server/einterfaces/cluster.go Обычный файл
Просмотреть файл

@@ -0,0 +1,32 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type ClusterMessageHandler func(msg *model.ClusterMessage)
type ClusterInterface interface {
StartInterNodeCommunication()
StopInterNodeCommunication()
RegisterClusterMessageHandler(event model.ClusterEvent, crm ClusterMessageHandler)
GetClusterId() string
IsLeader() bool
// HealthScore returns a number which is indicative of how well an instance is meeting
// the soft real-time requirements of the protocol. Lower numbers are better,
// and zero means "totally healthy".
HealthScore() int
GetMyClusterInfo() *model.ClusterInfo
GetClusterInfos() []*model.ClusterInfo
SendClusterMessage(msg *model.ClusterMessage)
SendClusterMessageToNode(nodeID string, msg *model.ClusterMessage) error
NotifyMsg(buf []byte)
GetClusterStats() ([]*model.ClusterStats, *model.AppError)
GetLogs(page, perPage int) ([]string, *model.AppError)
QueryLogs(page, perPage int) (map[string][]string, *model.AppError)
GetPluginStatuses() (model.PluginStatuses, *model.AppError)
ConfigChanged(previousConfig *model.Config, newConfig *model.Config, sendToOtherServer bool) *model.AppError
}

13
server/einterfaces/compliance.go Обычный файл
Просмотреть файл

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type ComplianceInterface interface {
StartComplianceDailyJob()
RunComplianceJob(job *model.Compliance) *model.AppError
}

26
server/einterfaces/data_retention.go Обычный файл
Просмотреть файл

@@ -0,0 +1,26 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type DataRetentionInterface interface {
GetGlobalPolicy() (*model.GlobalRetentionPolicy, *model.AppError)
GetPolicies(offset, limit int) (*model.RetentionPolicyWithTeamAndChannelCountsList, *model.AppError)
GetPoliciesCount() (int64, *model.AppError)
GetPolicy(policyID string) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)
CreatePolicy(policy *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)
PatchPolicy(patch *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)
DeletePolicy(policyID string) *model.AppError
GetTeamsForPolicy(policyID string, offset, limit int) (*model.TeamsWithCount, *model.AppError)
AddTeamsToPolicy(policyID string, teamIDs []string) *model.AppError
RemoveTeamsFromPolicy(policyID string, teamIDs []string) *model.AppError
GetChannelsForPolicy(policyID string, offset, limit int) (*model.ChannelsWithCount, *model.AppError)
AddChannelsToPolicy(policyID string, channelIDs []string) *model.AppError
RemoveChannelsFromPolicy(policyID string, channelIDs []string) *model.AppError
GetTeamPoliciesForUser(userID string, offset, limit int) (*model.RetentionPolicyForTeamList, *model.AppError)
GetChannelPoliciesForUser(userID string, offset, limit int) (*model.RetentionPolicyForChannelList, *model.AppError)
}

13
server/einterfaces/jobs/cloud_interface.go Обычный файл
Просмотреть файл

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type CloudJobInterface interface {
MakeWorker() model.Worker
MakeScheduler() model.Scheduler
}

13
server/einterfaces/jobs/data_retention.go Обычный файл
Просмотреть файл

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type DataRetentionJobInterface interface {
MakeWorker() model.Worker
MakeScheduler() model.Scheduler
}

21
server/einterfaces/jobs/elasticsearch.go Обычный файл
Просмотреть файл

@@ -0,0 +1,21 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type ElasticsearchIndexerInterface interface {
MakeWorker() model.Worker
}
type ElasticsearchAggregatorInterface interface {
MakeWorker() model.Worker
MakeScheduler() model.Scheduler
}
type ElasticsearchFixChannelIndexInterface interface {
MakeWorker() model.Worker
}

Просмотреть файл

@@ -0,0 +1,12 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type IndexerJobInterface interface {
MakeWorker() model.Worker
}

13
server/einterfaces/jobs/ldap_sync.go Обычный файл
Просмотреть файл

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type LdapSyncInterface interface {
MakeWorker() model.Worker
MakeScheduler() model.Scheduler
}

13
server/einterfaces/jobs/message_export.go Обычный файл
Просмотреть файл

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package jobs
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type MessageExportJobInterface interface {
MakeWorker() model.Worker
MakeScheduler() model.Scheduler
}

30
server/einterfaces/ldap.go Обычный файл
Просмотреть файл

@@ -0,0 +1,30 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost-server/server/public/model"
"github.com/mattermost/mattermost-server/server/v8/channels/app/request"
)
type LdapInterface interface {
DoLogin(c *request.Context, id string, password string) (*model.User, *model.AppError)
GetUser(id string) (*model.User, *model.AppError)
GetUserAttributes(id string, attributes []string) (map[string]string, *model.AppError)
CheckPassword(id string, password string) *model.AppError
CheckPasswordAuthData(authData string, password string) *model.AppError
CheckProviderAttributes(LS *model.LdapSettings, ouser *model.User, patch *model.UserPatch) string
SwitchToLdap(userID, ldapID, ldapPassword string) *model.AppError
StartSynchronizeJob(waitForJobToFinish bool, includeRemovedMembers bool) (*model.Job, *model.AppError)
RunTest() *model.AppError
GetAllLdapUsers() ([]*model.User, *model.AppError)
MigrateIDAttribute(toAttribute string) error
GetGroup(groupUID string) (*model.Group, *model.AppError)
GetAllGroupsPage(page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)
FirstLoginSync(c *request.Context, user *model.User, userAuthService, userAuthData, email string) *model.AppError
UpdateProfilePictureIfNecessary(request.CTX, model.User, model.Session)
GetADLdapIdFromSAMLId(authData string) string
GetSAMLIdFromADLdapId(authData string) string
GetVendorNameAndVendorVersion() (string, string)
}

11
server/einterfaces/license.go Обычный файл
Просмотреть файл

@@ -0,0 +1,11 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import "github.com/mattermost/mattermost-server/server/public/model"
type LicenseInterface interface {
CanStartTrial() (bool, error)
GetPrevTrial() (*model.License, error)
}

15
server/einterfaces/message_export.go Обычный файл
Просмотреть файл

@@ -0,0 +1,15 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"context"
"github.com/mattermost/mattermost-server/server/public/model"
)
type MessageExportInterface interface {
StartSynchronizeJob(ctx context.Context, exportFromTimestamp int64) (*model.Job, *model.AppError)
RunExport(format string, since int64, limit int) (int64, *model.AppError)
}

87
server/einterfaces/metrics.go Обычный файл
Просмотреть файл

@@ -0,0 +1,87 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"database/sql"
"github.com/mattermost/mattermost-server/server/public/model"
"github.com/mattermost/mattermost-server/server/public/shared/mlog"
)
type MetricsInterface interface {
Register()
RegisterDBCollector(db *sql.DB, name string)
UnregisterDBCollector(db *sql.DB, name string)
IncrementPostCreate()
IncrementWebhookPost()
IncrementPostSentEmail()
IncrementPostSentPush()
IncrementPostBroadcast()
IncrementPostFileAttachment(count int)
IncrementHTTPRequest()
IncrementHTTPError()
IncrementClusterRequest()
ObserveClusterRequestDuration(elapsed float64)
IncrementClusterEventType(eventType model.ClusterEvent)
IncrementLogin()
IncrementLoginFail()
IncrementEtagHitCounter(route string)
IncrementEtagMissCounter(route string)
IncrementMemCacheHitCounter(cacheName string)
IncrementMemCacheMissCounter(cacheName string)
IncrementMemCacheInvalidationCounter(cacheName string)
IncrementMemCacheMissCounterSession()
IncrementMemCacheHitCounterSession()
IncrementMemCacheInvalidationCounterSession()
IncrementWebsocketEvent(eventType string)
IncrementWebSocketBroadcast(eventType string)
IncrementWebSocketBroadcastBufferSize(hub string, amount float64)
DecrementWebSocketBroadcastBufferSize(hub string, amount float64)
IncrementWebSocketBroadcastUsersRegistered(hub string, amount float64)
DecrementWebSocketBroadcastUsersRegistered(hub string, amount float64)
IncrementWebsocketReconnectEvent(eventType string)
AddMemCacheHitCounter(cacheName string, amount float64)
AddMemCacheMissCounter(cacheName string, amount float64)
IncrementPostsSearchCounter()
ObservePostsSearchDuration(elapsed float64)
IncrementFilesSearchCounter()
ObserveFilesSearchDuration(elapsed float64)
ObserveStoreMethodDuration(method, success string, elapsed float64)
ObserveAPIEndpointDuration(endpoint, method, statusCode string, elapsed float64)
IncrementPostIndexCounter()
IncrementFileIndexCounter()
IncrementUserIndexCounter()
IncrementChannelIndexCounter()
ObservePluginHookDuration(pluginID, hookName string, success bool, elapsed float64)
ObservePluginMultiHookIterationDuration(pluginID string, elapsed float64)
ObservePluginMultiHookDuration(elapsed float64)
ObservePluginAPIDuration(pluginID, apiName string, success bool, elapsed float64)
ObserveEnabledUsers(users int64)
GetLoggerMetricsCollector() mlog.MetricsCollector
IncrementRemoteClusterMsgSentCounter(remoteID string)
IncrementRemoteClusterMsgReceivedCounter(remoteID string)
IncrementRemoteClusterMsgErrorsCounter(remoteID string, timeout bool)
ObserveRemoteClusterPingDuration(remoteID string, elapsed float64)
ObserveRemoteClusterClockSkew(remoteID string, skew float64)
IncrementRemoteClusterConnStateChangeCounter(remoteID string, online bool)
IncrementJobActive(jobType string)
DecrementJobActive(jobType string)
SetReplicaLagAbsolute(node string, value float64)
SetReplicaLagTime(node string, value float64)
}

15
server/einterfaces/mfa.go Обычный файл
Просмотреть файл

@@ -0,0 +1,15 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type MfaInterface interface {
GenerateSecret(user *model.User) (string, []byte, *model.AppError)
Activate(user *model.User, token string) *model.AppError
Deactivate(userID string) *model.AppError
ValidateToken(secret, token string) (bool, *model.AppError)
}

Просмотреть файл

@@ -0,0 +1,62 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// AccountMigrationInterface is an autogenerated mock type for the AccountMigrationInterface type
type AccountMigrationInterface struct {
mock.Mock
}
// MigrateToLdap provides a mock function with given fields: fromAuthService, foreignUserFieldNameToMatch, force, dryRun
func (_m *AccountMigrationInterface) MigrateToLdap(fromAuthService string, foreignUserFieldNameToMatch string, force bool, dryRun bool) *model.AppError {
ret := _m.Called(fromAuthService, foreignUserFieldNameToMatch, force, dryRun)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, string, bool, bool) *model.AppError); ok {
r0 = rf(fromAuthService, foreignUserFieldNameToMatch, force, dryRun)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// MigrateToSaml provides a mock function with given fields: fromAuthService, usersMap, auto, dryRun
func (_m *AccountMigrationInterface) MigrateToSaml(fromAuthService string, usersMap map[string]string, auto bool, dryRun bool) *model.AppError {
ret := _m.Called(fromAuthService, usersMap, auto, dryRun)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, map[string]string, bool, bool) *model.AppError); ok {
r0 = rf(fromAuthService, usersMap, auto, dryRun)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
type mockConstructorTestingTNewAccountMigrationInterface interface {
mock.TestingT
Cleanup(func())
}
// NewAccountMigrationInterface creates a new instance of AccountMigrationInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewAccountMigrationInterface(t mockConstructorTestingTNewAccountMigrationInterface) *AccountMigrationInterface {
mock := &AccountMigrationInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,118 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// AppContextInterface is an autogenerated mock type for the AppContextInterface type
type AppContextInterface struct {
mock.Mock
}
// AcceptLanguage provides a mock function with given fields:
func (_m *AppContextInterface) AcceptLanguage() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// IPAddress provides a mock function with given fields:
func (_m *AppContextInterface) IPAddress() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// Path provides a mock function with given fields:
func (_m *AppContextInterface) Path() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// RequestId provides a mock function with given fields:
func (_m *AppContextInterface) RequestId() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// Session provides a mock function with given fields:
func (_m *AppContextInterface) Session() *model.Session {
ret := _m.Called()
var r0 *model.Session
if rf, ok := ret.Get(0).(func() *model.Session); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Session)
}
}
return r0
}
// T provides a mock function with given fields: translationID, args
func (_m *AppContextInterface) T(translationID string, args ...any) string {
var _ca []any
_ca = append(_ca, translationID)
_ca = append(_ca, args...)
ret := _m.Called(_ca...)
var r0 string
if rf, ok := ret.Get(0).(func(string, ...any) string); ok {
r0 = rf(translationID, args...)
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// UserAgent provides a mock function with given fields:
func (_m *AppContextInterface) UserAgent() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}

730
server/einterfaces/mocks/CloudInterface.go Обычный файл
Просмотреть файл

@@ -0,0 +1,730 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// CloudInterface is an autogenerated mock type for the CloudInterface type
type CloudInterface struct {
mock.Mock
}
// BootstrapSelfHostedSignup provides a mock function with given fields: req
func (_m *CloudInterface) BootstrapSelfHostedSignup(req model.BootstrapSelfHostedSignupRequest) (*model.BootstrapSelfHostedSignupResponse, error) {
ret := _m.Called(req)
var r0 *model.BootstrapSelfHostedSignupResponse
var r1 error
if rf, ok := ret.Get(0).(func(model.BootstrapSelfHostedSignupRequest) (*model.BootstrapSelfHostedSignupResponse, error)); ok {
return rf(req)
}
if rf, ok := ret.Get(0).(func(model.BootstrapSelfHostedSignupRequest) *model.BootstrapSelfHostedSignupResponse); ok {
r0 = rf(req)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.BootstrapSelfHostedSignupResponse)
}
}
if rf, ok := ret.Get(1).(func(model.BootstrapSelfHostedSignupRequest) error); ok {
r1 = rf(req)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ChangeSubscription provides a mock function with given fields: userID, subscriptionID, subscriptionChange
func (_m *CloudInterface) ChangeSubscription(userID string, subscriptionID string, subscriptionChange *model.SubscriptionChange) (*model.Subscription, error) {
ret := _m.Called(userID, subscriptionID, subscriptionChange)
var r0 *model.Subscription
var r1 error
if rf, ok := ret.Get(0).(func(string, string, *model.SubscriptionChange) (*model.Subscription, error)); ok {
return rf(userID, subscriptionID, subscriptionChange)
}
if rf, ok := ret.Get(0).(func(string, string, *model.SubscriptionChange) *model.Subscription); ok {
r0 = rf(userID, subscriptionID, subscriptionChange)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Subscription)
}
}
if rf, ok := ret.Get(1).(func(string, string, *model.SubscriptionChange) error); ok {
r1 = rf(userID, subscriptionID, subscriptionChange)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CheckCWSConnection provides a mock function with given fields: userId
func (_m *CloudInterface) CheckCWSConnection(userId string) error {
ret := _m.Called(userId)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(userId)
} else {
r0 = ret.Error(0)
}
return r0
}
// ConfirmCustomerPayment provides a mock function with given fields: userID, confirmRequest
func (_m *CloudInterface) ConfirmCustomerPayment(userID string, confirmRequest *model.ConfirmPaymentMethodRequest) error {
ret := _m.Called(userID, confirmRequest)
var r0 error
if rf, ok := ret.Get(0).(func(string, *model.ConfirmPaymentMethodRequest) error); ok {
r0 = rf(userID, confirmRequest)
} else {
r0 = ret.Error(0)
}
return r0
}
// ConfirmSelfHostedExpansion provides a mock function with given fields: req, requesterEmail
func (_m *CloudInterface) ConfirmSelfHostedExpansion(req model.SelfHostedConfirmPaymentMethodRequest, requesterEmail string) (*model.SelfHostedSignupConfirmResponse, error) {
ret := _m.Called(req, requesterEmail)
var r0 *model.SelfHostedSignupConfirmResponse
var r1 error
if rf, ok := ret.Get(0).(func(model.SelfHostedConfirmPaymentMethodRequest, string) (*model.SelfHostedSignupConfirmResponse, error)); ok {
return rf(req, requesterEmail)
}
if rf, ok := ret.Get(0).(func(model.SelfHostedConfirmPaymentMethodRequest, string) *model.SelfHostedSignupConfirmResponse); ok {
r0 = rf(req, requesterEmail)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SelfHostedSignupConfirmResponse)
}
}
if rf, ok := ret.Get(1).(func(model.SelfHostedConfirmPaymentMethodRequest, string) error); ok {
r1 = rf(req, requesterEmail)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ConfirmSelfHostedSignup provides a mock function with given fields: req, requesterEmail
func (_m *CloudInterface) ConfirmSelfHostedSignup(req model.SelfHostedConfirmPaymentMethodRequest, requesterEmail string) (*model.SelfHostedSignupConfirmResponse, error) {
ret := _m.Called(req, requesterEmail)
var r0 *model.SelfHostedSignupConfirmResponse
var r1 error
if rf, ok := ret.Get(0).(func(model.SelfHostedConfirmPaymentMethodRequest, string) (*model.SelfHostedSignupConfirmResponse, error)); ok {
return rf(req, requesterEmail)
}
if rf, ok := ret.Get(0).(func(model.SelfHostedConfirmPaymentMethodRequest, string) *model.SelfHostedSignupConfirmResponse); ok {
r0 = rf(req, requesterEmail)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SelfHostedSignupConfirmResponse)
}
}
if rf, ok := ret.Get(1).(func(model.SelfHostedConfirmPaymentMethodRequest, string) error); ok {
r1 = rf(req, requesterEmail)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ConfirmSelfHostedSignupLicenseApplication provides a mock function with given fields:
func (_m *CloudInterface) ConfirmSelfHostedSignupLicenseApplication() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// CreateCustomerPayment provides a mock function with given fields: userID
func (_m *CloudInterface) CreateCustomerPayment(userID string) (*model.StripeSetupIntent, error) {
ret := _m.Called(userID)
var r0 *model.StripeSetupIntent
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.StripeSetupIntent, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) *model.StripeSetupIntent); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.StripeSetupIntent)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CreateCustomerSelfHostedSignup provides a mock function with given fields: req, requesterEmail
func (_m *CloudInterface) CreateCustomerSelfHostedSignup(req model.SelfHostedCustomerForm, requesterEmail string) (*model.SelfHostedSignupCustomerResponse, error) {
ret := _m.Called(req, requesterEmail)
var r0 *model.SelfHostedSignupCustomerResponse
var r1 error
if rf, ok := ret.Get(0).(func(model.SelfHostedCustomerForm, string) (*model.SelfHostedSignupCustomerResponse, error)); ok {
return rf(req, requesterEmail)
}
if rf, ok := ret.Get(0).(func(model.SelfHostedCustomerForm, string) *model.SelfHostedSignupCustomerResponse); ok {
r0 = rf(req, requesterEmail)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SelfHostedSignupCustomerResponse)
}
}
if rf, ok := ret.Get(1).(func(model.SelfHostedCustomerForm, string) error); ok {
r1 = rf(req, requesterEmail)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CreateOrUpdateSubscriptionHistoryEvent provides a mock function with given fields: userID, userCount
func (_m *CloudInterface) CreateOrUpdateSubscriptionHistoryEvent(userID string, userCount int) (*model.SubscriptionHistory, error) {
ret := _m.Called(userID, userCount)
var r0 *model.SubscriptionHistory
var r1 error
if rf, ok := ret.Get(0).(func(string, int) (*model.SubscriptionHistory, error)); ok {
return rf(userID, userCount)
}
if rf, ok := ret.Get(0).(func(string, int) *model.SubscriptionHistory); ok {
r0 = rf(userID, userCount)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SubscriptionHistory)
}
}
if rf, ok := ret.Get(1).(func(string, int) error); ok {
r1 = rf(userID, userCount)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetCloudCustomer provides a mock function with given fields: userID
func (_m *CloudInterface) GetCloudCustomer(userID string) (*model.CloudCustomer, error) {
ret := _m.Called(userID)
var r0 *model.CloudCustomer
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.CloudCustomer, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) *model.CloudCustomer); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.CloudCustomer)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetCloudLimits provides a mock function with given fields: userID
func (_m *CloudInterface) GetCloudLimits(userID string) (*model.ProductLimits, error) {
ret := _m.Called(userID)
var r0 *model.ProductLimits
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.ProductLimits, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) *model.ProductLimits); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.ProductLimits)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetCloudProduct provides a mock function with given fields: userID, productID
func (_m *CloudInterface) GetCloudProduct(userID string, productID string) (*model.Product, error) {
ret := _m.Called(userID, productID)
var r0 *model.Product
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (*model.Product, error)); ok {
return rf(userID, productID)
}
if rf, ok := ret.Get(0).(func(string, string) *model.Product); ok {
r0 = rf(userID, productID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Product)
}
}
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(userID, productID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetCloudProducts provides a mock function with given fields: userID, includeLegacyProducts
func (_m *CloudInterface) GetCloudProducts(userID string, includeLegacyProducts bool) ([]*model.Product, error) {
ret := _m.Called(userID, includeLegacyProducts)
var r0 []*model.Product
var r1 error
if rf, ok := ret.Get(0).(func(string, bool) ([]*model.Product, error)); ok {
return rf(userID, includeLegacyProducts)
}
if rf, ok := ret.Get(0).(func(string, bool) []*model.Product); ok {
r0 = rf(userID, includeLegacyProducts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Product)
}
}
if rf, ok := ret.Get(1).(func(string, bool) error); ok {
r1 = rf(userID, includeLegacyProducts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetInvoicePDF provides a mock function with given fields: userID, invoiceID
func (_m *CloudInterface) GetInvoicePDF(userID string, invoiceID string) ([]byte, string, error) {
ret := _m.Called(userID, invoiceID)
var r0 []byte
var r1 string
var r2 error
if rf, ok := ret.Get(0).(func(string, string) ([]byte, string, error)); ok {
return rf(userID, invoiceID)
}
if rf, ok := ret.Get(0).(func(string, string) []byte); ok {
r0 = rf(userID, invoiceID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
if rf, ok := ret.Get(1).(func(string, string) string); ok {
r1 = rf(userID, invoiceID)
} else {
r1 = ret.Get(1).(string)
}
if rf, ok := ret.Get(2).(func(string, string) error); ok {
r2 = rf(userID, invoiceID)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// GetInvoicesForSubscription provides a mock function with given fields: userID
func (_m *CloudInterface) GetInvoicesForSubscription(userID string) ([]*model.Invoice, error) {
ret := _m.Called(userID)
var r0 []*model.Invoice
var r1 error
if rf, ok := ret.Get(0).(func(string) ([]*model.Invoice, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) []*model.Invoice); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Invoice)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetLicenseSelfServeStatus provides a mock function with given fields: userID, token
func (_m *CloudInterface) GetLicenseSelfServeStatus(userID string, token string) (*model.SubscriptionLicenseSelfServeStatusResponse, error) {
ret := _m.Called(userID, token)
var r0 *model.SubscriptionLicenseSelfServeStatusResponse
var r1 error
if rf, ok := ret.Get(0).(func(string, string) (*model.SubscriptionLicenseSelfServeStatusResponse, error)); ok {
return rf(userID, token)
}
if rf, ok := ret.Get(0).(func(string, string) *model.SubscriptionLicenseSelfServeStatusResponse); ok {
r0 = rf(userID, token)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SubscriptionLicenseSelfServeStatusResponse)
}
}
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(userID, token)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetSelfHostedInvoicePDF provides a mock function with given fields: invoiceID
func (_m *CloudInterface) GetSelfHostedInvoicePDF(invoiceID string) ([]byte, string, error) {
ret := _m.Called(invoiceID)
var r0 []byte
var r1 string
var r2 error
if rf, ok := ret.Get(0).(func(string) ([]byte, string, error)); ok {
return rf(invoiceID)
}
if rf, ok := ret.Get(0).(func(string) []byte); ok {
r0 = rf(invoiceID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
if rf, ok := ret.Get(1).(func(string) string); ok {
r1 = rf(invoiceID)
} else {
r1 = ret.Get(1).(string)
}
if rf, ok := ret.Get(2).(func(string) error); ok {
r2 = rf(invoiceID)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// GetSelfHostedInvoices provides a mock function with given fields:
func (_m *CloudInterface) GetSelfHostedInvoices() ([]*model.Invoice, error) {
ret := _m.Called()
var r0 []*model.Invoice
var r1 error
if rf, ok := ret.Get(0).(func() ([]*model.Invoice, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.Invoice); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Invoice)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetSelfHostedProducts provides a mock function with given fields: userID
func (_m *CloudInterface) GetSelfHostedProducts(userID string) ([]*model.Product, error) {
ret := _m.Called(userID)
var r0 []*model.Product
var r1 error
if rf, ok := ret.Get(0).(func(string) ([]*model.Product, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) []*model.Product); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Product)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetSubscription provides a mock function with given fields: userID
func (_m *CloudInterface) GetSubscription(userID string) (*model.Subscription, error) {
ret := _m.Called(userID)
var r0 *model.Subscription
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.Subscription, error)); ok {
return rf(userID)
}
if rf, ok := ret.Get(0).(func(string) *model.Subscription); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Subscription)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// HandleLicenseChange provides a mock function with given fields:
func (_m *CloudInterface) HandleLicenseChange() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// InvalidateCaches provides a mock function with given fields:
func (_m *CloudInterface) InvalidateCaches() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// RequestCloudTrial provides a mock function with given fields: userID, subscriptionID, newValidBusinessEmail
func (_m *CloudInterface) RequestCloudTrial(userID string, subscriptionID string, newValidBusinessEmail string) (*model.Subscription, error) {
ret := _m.Called(userID, subscriptionID, newValidBusinessEmail)
var r0 *model.Subscription
var r1 error
if rf, ok := ret.Get(0).(func(string, string, string) (*model.Subscription, error)); ok {
return rf(userID, subscriptionID, newValidBusinessEmail)
}
if rf, ok := ret.Get(0).(func(string, string, string) *model.Subscription); ok {
r0 = rf(userID, subscriptionID, newValidBusinessEmail)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Subscription)
}
}
if rf, ok := ret.Get(1).(func(string, string, string) error); ok {
r1 = rf(userID, subscriptionID, newValidBusinessEmail)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SelfHostedSignupAvailable provides a mock function with given fields:
func (_m *CloudInterface) SelfHostedSignupAvailable() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// SelfServeDeleteWorkspace provides a mock function with given fields: userID, deletionRequest
func (_m *CloudInterface) SelfServeDeleteWorkspace(userID string, deletionRequest *model.WorkspaceDeletionRequest) error {
ret := _m.Called(userID, deletionRequest)
var r0 error
if rf, ok := ret.Get(0).(func(string, *model.WorkspaceDeletionRequest) error); ok {
r0 = rf(userID, deletionRequest)
} else {
r0 = ret.Error(0)
}
return r0
}
// SubmitTrueUpReview provides a mock function with given fields: userID, trueUpReviewProfile
func (_m *CloudInterface) SubmitTrueUpReview(userID string, trueUpReviewProfile map[string]interface{}) error {
ret := _m.Called(userID, trueUpReviewProfile)
var r0 error
if rf, ok := ret.Get(0).(func(string, map[string]interface{}) error); ok {
r0 = rf(userID, trueUpReviewProfile)
} else {
r0 = ret.Error(0)
}
return r0
}
// SubscribeToNewsletter provides a mock function with given fields: userID, req
func (_m *CloudInterface) SubscribeToNewsletter(userID string, req *model.SubscribeNewsletterRequest) error {
ret := _m.Called(userID, req)
var r0 error
if rf, ok := ret.Get(0).(func(string, *model.SubscribeNewsletterRequest) error); ok {
r0 = rf(userID, req)
} else {
r0 = ret.Error(0)
}
return r0
}
// UpdateCloudCustomer provides a mock function with given fields: userID, customerInfo
func (_m *CloudInterface) UpdateCloudCustomer(userID string, customerInfo *model.CloudCustomerInfo) (*model.CloudCustomer, error) {
ret := _m.Called(userID, customerInfo)
var r0 *model.CloudCustomer
var r1 error
if rf, ok := ret.Get(0).(func(string, *model.CloudCustomerInfo) (*model.CloudCustomer, error)); ok {
return rf(userID, customerInfo)
}
if rf, ok := ret.Get(0).(func(string, *model.CloudCustomerInfo) *model.CloudCustomer); ok {
r0 = rf(userID, customerInfo)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.CloudCustomer)
}
}
if rf, ok := ret.Get(1).(func(string, *model.CloudCustomerInfo) error); ok {
r1 = rf(userID, customerInfo)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateCloudCustomerAddress provides a mock function with given fields: userID, address
func (_m *CloudInterface) UpdateCloudCustomerAddress(userID string, address *model.Address) (*model.CloudCustomer, error) {
ret := _m.Called(userID, address)
var r0 *model.CloudCustomer
var r1 error
if rf, ok := ret.Get(0).(func(string, *model.Address) (*model.CloudCustomer, error)); ok {
return rf(userID, address)
}
if rf, ok := ret.Get(0).(func(string, *model.Address) *model.CloudCustomer); ok {
r0 = rf(userID, address)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.CloudCustomer)
}
}
if rf, ok := ret.Get(1).(func(string, *model.Address) error); ok {
r1 = rf(userID, address)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ValidateBusinessEmail provides a mock function with given fields: userID, email
func (_m *CloudInterface) ValidateBusinessEmail(userID string, email string) error {
ret := _m.Called(userID, email)
var r0 error
if rf, ok := ret.Get(0).(func(string, string) error); ok {
r0 = rf(userID, email)
} else {
r0 = ret.Error(0)
}
return r0
}
type mockConstructorTestingTNewCloudInterface interface {
mock.TestingT
Cleanup(func())
}
// NewCloudInterface creates a new instance of CloudInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewCloudInterface(t mockConstructorTestingTNewCloudInterface) *CloudInterface {
mock := &CloudInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,62 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// CloudJobInterface is an autogenerated mock type for the CloudJobInterface type
type CloudJobInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with given fields:
func (_m *CloudJobInterface) MakeScheduler() model.Scheduler {
ret := _m.Called()
var r0 model.Scheduler
if rf, ok := ret.Get(0).(func() model.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with given fields:
func (_m *CloudJobInterface) MakeWorker() model.Worker {
ret := _m.Called()
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
type mockConstructorTestingTNewCloudJobInterface interface {
mock.TestingT
Cleanup(func())
}
// NewCloudJobInterface creates a new instance of CloudJobInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewCloudJobInterface(t mockConstructorTestingTNewCloudJobInterface) *CloudJobInterface {
mock := &CloudJobInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

273
server/einterfaces/mocks/ClusterInterface.go Обычный файл
Просмотреть файл

@@ -0,0 +1,273 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
einterfaces "github.com/mattermost/mattermost-server/server/v8/einterfaces"
mock "github.com/stretchr/testify/mock"
model "github.com/mattermost/mattermost-server/server/public/model"
)
// ClusterInterface is an autogenerated mock type for the ClusterInterface type
type ClusterInterface struct {
mock.Mock
}
// ConfigChanged provides a mock function with given fields: previousConfig, newConfig, sendToOtherServer
func (_m *ClusterInterface) ConfigChanged(previousConfig *model.Config, newConfig *model.Config, sendToOtherServer bool) *model.AppError {
ret := _m.Called(previousConfig, newConfig, sendToOtherServer)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(*model.Config, *model.Config, bool) *model.AppError); ok {
r0 = rf(previousConfig, newConfig, sendToOtherServer)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GetClusterId provides a mock function with given fields:
func (_m *ClusterInterface) GetClusterId() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// GetClusterInfos provides a mock function with given fields:
func (_m *ClusterInterface) GetClusterInfos() []*model.ClusterInfo {
ret := _m.Called()
var r0 []*model.ClusterInfo
if rf, ok := ret.Get(0).(func() []*model.ClusterInfo); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.ClusterInfo)
}
}
return r0
}
// GetClusterStats provides a mock function with given fields:
func (_m *ClusterInterface) GetClusterStats() ([]*model.ClusterStats, *model.AppError) {
ret := _m.Called()
var r0 []*model.ClusterStats
var r1 *model.AppError
if rf, ok := ret.Get(0).(func() ([]*model.ClusterStats, *model.AppError)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.ClusterStats); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.ClusterStats)
}
}
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
r1 = rf()
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetLogs provides a mock function with given fields: page, perPage
func (_m *ClusterInterface) GetLogs(page int, perPage int) ([]string, *model.AppError) {
ret := _m.Called(page, perPage)
var r0 []string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(int, int) ([]string, *model.AppError)); ok {
return rf(page, perPage)
}
if rf, ok := ret.Get(0).(func(int, int) []string); ok {
r0 = rf(page, perPage)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
if rf, ok := ret.Get(1).(func(int, int) *model.AppError); ok {
r1 = rf(page, perPage)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetMyClusterInfo provides a mock function with given fields:
func (_m *ClusterInterface) GetMyClusterInfo() *model.ClusterInfo {
ret := _m.Called()
var r0 *model.ClusterInfo
if rf, ok := ret.Get(0).(func() *model.ClusterInfo); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.ClusterInfo)
}
}
return r0
}
// GetPluginStatuses provides a mock function with given fields:
func (_m *ClusterInterface) GetPluginStatuses() (model.PluginStatuses, *model.AppError) {
ret := _m.Called()
var r0 model.PluginStatuses
var r1 *model.AppError
if rf, ok := ret.Get(0).(func() (model.PluginStatuses, *model.AppError)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() model.PluginStatuses); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.PluginStatuses)
}
}
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
r1 = rf()
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// HealthScore provides a mock function with given fields:
func (_m *ClusterInterface) HealthScore() int {
ret := _m.Called()
var r0 int
if rf, ok := ret.Get(0).(func() int); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int)
}
return r0
}
// IsLeader provides a mock function with given fields:
func (_m *ClusterInterface) IsLeader() bool {
ret := _m.Called()
var r0 bool
if rf, ok := ret.Get(0).(func() bool); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
// NotifyMsg provides a mock function with given fields: buf
func (_m *ClusterInterface) NotifyMsg(buf []byte) {
_m.Called(buf)
}
// QueryLogs provides a mock function with given fields: page, perPage
func (_m *ClusterInterface) QueryLogs(page int, perPage int) (map[string][]string, *model.AppError) {
ret := _m.Called(page, perPage)
var r0 map[string][]string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(int, int) (map[string][]string, *model.AppError)); ok {
return rf(page, perPage)
}
if rf, ok := ret.Get(0).(func(int, int) map[string][]string); ok {
r0 = rf(page, perPage)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string][]string)
}
}
if rf, ok := ret.Get(1).(func(int, int) *model.AppError); ok {
r1 = rf(page, perPage)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// RegisterClusterMessageHandler provides a mock function with given fields: event, crm
func (_m *ClusterInterface) RegisterClusterMessageHandler(event model.ClusterEvent, crm einterfaces.ClusterMessageHandler) {
_m.Called(event, crm)
}
// SendClusterMessage provides a mock function with given fields: msg
func (_m *ClusterInterface) SendClusterMessage(msg *model.ClusterMessage) {
_m.Called(msg)
}
// SendClusterMessageToNode provides a mock function with given fields: nodeID, msg
func (_m *ClusterInterface) SendClusterMessageToNode(nodeID string, msg *model.ClusterMessage) error {
ret := _m.Called(nodeID, msg)
var r0 error
if rf, ok := ret.Get(0).(func(string, *model.ClusterMessage) error); ok {
r0 = rf(nodeID, msg)
} else {
r0 = ret.Error(0)
}
return r0
}
// StartInterNodeCommunication provides a mock function with given fields:
func (_m *ClusterInterface) StartInterNodeCommunication() {
_m.Called()
}
// StopInterNodeCommunication provides a mock function with given fields:
func (_m *ClusterInterface) StopInterNodeCommunication() {
_m.Called()
}
type mockConstructorTestingTNewClusterInterface interface {
mock.TestingT
Cleanup(func())
}
// NewClusterInterface creates a new instance of ClusterInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewClusterInterface(t mockConstructorTestingTNewClusterInterface) *ClusterInterface {
mock := &ClusterInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,35 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// ClusterMessageHandler is an autogenerated mock type for the ClusterMessageHandler type
type ClusterMessageHandler struct {
mock.Mock
}
// Execute provides a mock function with given fields: msg
func (_m *ClusterMessageHandler) Execute(msg *model.ClusterMessage) {
_m.Called(msg)
}
type mockConstructorTestingTNewClusterMessageHandler interface {
mock.TestingT
Cleanup(func())
}
// NewClusterMessageHandler creates a new instance of ClusterMessageHandler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewClusterMessageHandler(t mockConstructorTestingTNewClusterMessageHandler) *ClusterMessageHandler {
mock := &ClusterMessageHandler{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,51 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// ComplianceInterface is an autogenerated mock type for the ComplianceInterface type
type ComplianceInterface struct {
mock.Mock
}
// RunComplianceJob provides a mock function with given fields: job
func (_m *ComplianceInterface) RunComplianceJob(job *model.Compliance) *model.AppError {
ret := _m.Called(job)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(*model.Compliance) *model.AppError); ok {
r0 = rf(job)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// StartComplianceDailyJob provides a mock function with given fields:
func (_m *ComplianceInterface) StartComplianceDailyJob() {
_m.Called()
}
type mockConstructorTestingTNewComplianceInterface interface {
mock.TestingT
Cleanup(func())
}
// NewComplianceInterface creates a new instance of ComplianceInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewComplianceInterface(t mockConstructorTestingTNewComplianceInterface) *ComplianceInterface {
mock := &ComplianceInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,388 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// DataRetentionInterface is an autogenerated mock type for the DataRetentionInterface type
type DataRetentionInterface struct {
mock.Mock
}
// AddChannelsToPolicy provides a mock function with given fields: policyID, channelIDs
func (_m *DataRetentionInterface) AddChannelsToPolicy(policyID string, channelIDs []string) *model.AppError {
ret := _m.Called(policyID, channelIDs)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, []string) *model.AppError); ok {
r0 = rf(policyID, channelIDs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// AddTeamsToPolicy provides a mock function with given fields: policyID, teamIDs
func (_m *DataRetentionInterface) AddTeamsToPolicy(policyID string, teamIDs []string) *model.AppError {
ret := _m.Called(policyID, teamIDs)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, []string) *model.AppError); ok {
r0 = rf(policyID, teamIDs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// CreatePolicy provides a mock function with given fields: policy
func (_m *DataRetentionInterface) CreatePolicy(policy *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError) {
ret := _m.Called(policy)
var r0 *model.RetentionPolicyWithTeamAndChannelCounts
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(*model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)); ok {
return rf(policy)
}
if rf, ok := ret.Get(0).(func(*model.RetentionPolicyWithTeamAndChannelIDs) *model.RetentionPolicyWithTeamAndChannelCounts); ok {
r0 = rf(policy)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyWithTeamAndChannelCounts)
}
}
if rf, ok := ret.Get(1).(func(*model.RetentionPolicyWithTeamAndChannelIDs) *model.AppError); ok {
r1 = rf(policy)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// DeletePolicy provides a mock function with given fields: policyID
func (_m *DataRetentionInterface) DeletePolicy(policyID string) *model.AppError {
ret := _m.Called(policyID)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
r0 = rf(policyID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GetChannelPoliciesForUser provides a mock function with given fields: userID, offset, limit
func (_m *DataRetentionInterface) GetChannelPoliciesForUser(userID string, offset int, limit int) (*model.RetentionPolicyForChannelList, *model.AppError) {
ret := _m.Called(userID, offset, limit)
var r0 *model.RetentionPolicyForChannelList
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, int, int) (*model.RetentionPolicyForChannelList, *model.AppError)); ok {
return rf(userID, offset, limit)
}
if rf, ok := ret.Get(0).(func(string, int, int) *model.RetentionPolicyForChannelList); ok {
r0 = rf(userID, offset, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyForChannelList)
}
}
if rf, ok := ret.Get(1).(func(string, int, int) *model.AppError); ok {
r1 = rf(userID, offset, limit)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetChannelsForPolicy provides a mock function with given fields: policyID, offset, limit
func (_m *DataRetentionInterface) GetChannelsForPolicy(policyID string, offset int, limit int) (*model.ChannelsWithCount, *model.AppError) {
ret := _m.Called(policyID, offset, limit)
var r0 *model.ChannelsWithCount
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, int, int) (*model.ChannelsWithCount, *model.AppError)); ok {
return rf(policyID, offset, limit)
}
if rf, ok := ret.Get(0).(func(string, int, int) *model.ChannelsWithCount); ok {
r0 = rf(policyID, offset, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.ChannelsWithCount)
}
}
if rf, ok := ret.Get(1).(func(string, int, int) *model.AppError); ok {
r1 = rf(policyID, offset, limit)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetGlobalPolicy provides a mock function with given fields:
func (_m *DataRetentionInterface) GetGlobalPolicy() (*model.GlobalRetentionPolicy, *model.AppError) {
ret := _m.Called()
var r0 *model.GlobalRetentionPolicy
var r1 *model.AppError
if rf, ok := ret.Get(0).(func() (*model.GlobalRetentionPolicy, *model.AppError)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() *model.GlobalRetentionPolicy); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.GlobalRetentionPolicy)
}
}
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
r1 = rf()
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPolicies provides a mock function with given fields: offset, limit
func (_m *DataRetentionInterface) GetPolicies(offset int, limit int) (*model.RetentionPolicyWithTeamAndChannelCountsList, *model.AppError) {
ret := _m.Called(offset, limit)
var r0 *model.RetentionPolicyWithTeamAndChannelCountsList
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(int, int) (*model.RetentionPolicyWithTeamAndChannelCountsList, *model.AppError)); ok {
return rf(offset, limit)
}
if rf, ok := ret.Get(0).(func(int, int) *model.RetentionPolicyWithTeamAndChannelCountsList); ok {
r0 = rf(offset, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyWithTeamAndChannelCountsList)
}
}
if rf, ok := ret.Get(1).(func(int, int) *model.AppError); ok {
r1 = rf(offset, limit)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPoliciesCount provides a mock function with given fields:
func (_m *DataRetentionInterface) GetPoliciesCount() (int64, *model.AppError) {
ret := _m.Called()
var r0 int64
var r1 *model.AppError
if rf, ok := ret.Get(0).(func() (int64, *model.AppError)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() int64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int64)
}
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
r1 = rf()
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetPolicy provides a mock function with given fields: policyID
func (_m *DataRetentionInterface) GetPolicy(policyID string) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError) {
ret := _m.Called(policyID)
var r0 *model.RetentionPolicyWithTeamAndChannelCounts
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)); ok {
return rf(policyID)
}
if rf, ok := ret.Get(0).(func(string) *model.RetentionPolicyWithTeamAndChannelCounts); ok {
r0 = rf(policyID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyWithTeamAndChannelCounts)
}
}
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(policyID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetTeamPoliciesForUser provides a mock function with given fields: userID, offset, limit
func (_m *DataRetentionInterface) GetTeamPoliciesForUser(userID string, offset int, limit int) (*model.RetentionPolicyForTeamList, *model.AppError) {
ret := _m.Called(userID, offset, limit)
var r0 *model.RetentionPolicyForTeamList
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, int, int) (*model.RetentionPolicyForTeamList, *model.AppError)); ok {
return rf(userID, offset, limit)
}
if rf, ok := ret.Get(0).(func(string, int, int) *model.RetentionPolicyForTeamList); ok {
r0 = rf(userID, offset, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyForTeamList)
}
}
if rf, ok := ret.Get(1).(func(string, int, int) *model.AppError); ok {
r1 = rf(userID, offset, limit)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetTeamsForPolicy provides a mock function with given fields: policyID, offset, limit
func (_m *DataRetentionInterface) GetTeamsForPolicy(policyID string, offset int, limit int) (*model.TeamsWithCount, *model.AppError) {
ret := _m.Called(policyID, offset, limit)
var r0 *model.TeamsWithCount
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, int, int) (*model.TeamsWithCount, *model.AppError)); ok {
return rf(policyID, offset, limit)
}
if rf, ok := ret.Get(0).(func(string, int, int) *model.TeamsWithCount); ok {
r0 = rf(policyID, offset, limit)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.TeamsWithCount)
}
}
if rf, ok := ret.Get(1).(func(string, int, int) *model.AppError); ok {
r1 = rf(policyID, offset, limit)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// PatchPolicy provides a mock function with given fields: patch
func (_m *DataRetentionInterface) PatchPolicy(patch *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError) {
ret := _m.Called(patch)
var r0 *model.RetentionPolicyWithTeamAndChannelCounts
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(*model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, *model.AppError)); ok {
return rf(patch)
}
if rf, ok := ret.Get(0).(func(*model.RetentionPolicyWithTeamAndChannelIDs) *model.RetentionPolicyWithTeamAndChannelCounts); ok {
r0 = rf(patch)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.RetentionPolicyWithTeamAndChannelCounts)
}
}
if rf, ok := ret.Get(1).(func(*model.RetentionPolicyWithTeamAndChannelIDs) *model.AppError); ok {
r1 = rf(patch)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// RemoveChannelsFromPolicy provides a mock function with given fields: policyID, channelIDs
func (_m *DataRetentionInterface) RemoveChannelsFromPolicy(policyID string, channelIDs []string) *model.AppError {
ret := _m.Called(policyID, channelIDs)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, []string) *model.AppError); ok {
r0 = rf(policyID, channelIDs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// RemoveTeamsFromPolicy provides a mock function with given fields: policyID, teamIDs
func (_m *DataRetentionInterface) RemoveTeamsFromPolicy(policyID string, teamIDs []string) *model.AppError {
ret := _m.Called(policyID, teamIDs)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, []string) *model.AppError); ok {
r0 = rf(policyID, teamIDs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
type mockConstructorTestingTNewDataRetentionInterface interface {
mock.TestingT
Cleanup(func())
}
// NewDataRetentionInterface creates a new instance of DataRetentionInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewDataRetentionInterface(t mockConstructorTestingTNewDataRetentionInterface) *DataRetentionInterface {
mock := &DataRetentionInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,62 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// DataRetentionJobInterface is an autogenerated mock type for the DataRetentionJobInterface type
type DataRetentionJobInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with given fields:
func (_m *DataRetentionJobInterface) MakeScheduler() model.Scheduler {
ret := _m.Called()
var r0 model.Scheduler
if rf, ok := ret.Get(0).(func() model.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with given fields:
func (_m *DataRetentionJobInterface) MakeWorker() model.Worker {
ret := _m.Called()
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
type mockConstructorTestingTNewDataRetentionJobInterface interface {
mock.TestingT
Cleanup(func())
}
// NewDataRetentionJobInterface creates a new instance of DataRetentionJobInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewDataRetentionJobInterface(t mockConstructorTestingTNewDataRetentionJobInterface) *DataRetentionJobInterface {
mock := &DataRetentionJobInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,62 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// ElasticsearchAggregatorInterface is an autogenerated mock type for the ElasticsearchAggregatorInterface type
type ElasticsearchAggregatorInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with given fields:
func (_m *ElasticsearchAggregatorInterface) MakeScheduler() model.Scheduler {
ret := _m.Called()
var r0 model.Scheduler
if rf, ok := ret.Get(0).(func() model.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with given fields:
func (_m *ElasticsearchAggregatorInterface) MakeWorker() model.Worker {
ret := _m.Called()
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
type mockConstructorTestingTNewElasticsearchAggregatorInterface interface {
mock.TestingT
Cleanup(func())
}
// NewElasticsearchAggregatorInterface creates a new instance of ElasticsearchAggregatorInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewElasticsearchAggregatorInterface(t mockConstructorTestingTNewElasticsearchAggregatorInterface) *ElasticsearchAggregatorInterface {
mock := &ElasticsearchAggregatorInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,46 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// ElasticsearchFixChannelIndexInterface is an autogenerated mock type for the ElasticsearchFixChannelIndexInterface type
type ElasticsearchFixChannelIndexInterface struct {
mock.Mock
}
// MakeWorker provides a mock function with given fields:
func (_m *ElasticsearchFixChannelIndexInterface) MakeWorker() model.Worker {
ret := _m.Called()
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
type mockConstructorTestingTNewElasticsearchFixChannelIndexInterface interface {
mock.TestingT
Cleanup(func())
}
// NewElasticsearchFixChannelIndexInterface creates a new instance of ElasticsearchFixChannelIndexInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewElasticsearchFixChannelIndexInterface(t mockConstructorTestingTNewElasticsearchFixChannelIndexInterface) *ElasticsearchFixChannelIndexInterface {
mock := &ElasticsearchFixChannelIndexInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,46 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// ElasticsearchIndexerInterface is an autogenerated mock type for the ElasticsearchIndexerInterface type
type ElasticsearchIndexerInterface struct {
mock.Mock
}
// MakeWorker provides a mock function with given fields:
func (_m *ElasticsearchIndexerInterface) MakeWorker() model.Worker {
ret := _m.Called()
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
type mockConstructorTestingTNewElasticsearchIndexerInterface interface {
mock.TestingT
Cleanup(func())
}
// NewElasticsearchIndexerInterface creates a new instance of ElasticsearchIndexerInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewElasticsearchIndexerInterface(t mockConstructorTestingTNewElasticsearchIndexerInterface) *ElasticsearchIndexerInterface {
mock := &ElasticsearchIndexerInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,46 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// IndexerJobInterface is an autogenerated mock type for the IndexerJobInterface type
type IndexerJobInterface struct {
mock.Mock
}
// MakeWorker provides a mock function with given fields:
func (_m *IndexerJobInterface) MakeWorker() model.Worker {
ret := _m.Called()
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
type mockConstructorTestingTNewIndexerJobInterface interface {
mock.TestingT
Cleanup(func())
}
// NewIndexerJobInterface creates a new instance of IndexerJobInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewIndexerJobInterface(t mockConstructorTestingTNewIndexerJobInterface) *IndexerJobInterface {
mock := &IndexerJobInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

399
server/einterfaces/mocks/LdapInterface.go Обычный файл
Просмотреть файл

@@ -0,0 +1,399 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
request "github.com/mattermost/mattermost-server/server/v8/channels/app/request"
mock "github.com/stretchr/testify/mock"
)
// LdapInterface is an autogenerated mock type for the LdapInterface type
type LdapInterface struct {
mock.Mock
}
// CheckPassword provides a mock function with given fields: id, password
func (_m *LdapInterface) CheckPassword(id string, password string) *model.AppError {
ret := _m.Called(id, password)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, string) *model.AppError); ok {
r0 = rf(id, password)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// CheckPasswordAuthData provides a mock function with given fields: authData, password
func (_m *LdapInterface) CheckPasswordAuthData(authData string, password string) *model.AppError {
ret := _m.Called(authData, password)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, string) *model.AppError); ok {
r0 = rf(authData, password)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// CheckProviderAttributes provides a mock function with given fields: LS, ouser, patch
func (_m *LdapInterface) CheckProviderAttributes(LS *model.LdapSettings, ouser *model.User, patch *model.UserPatch) string {
ret := _m.Called(LS, ouser, patch)
var r0 string
if rf, ok := ret.Get(0).(func(*model.LdapSettings, *model.User, *model.UserPatch) string); ok {
r0 = rf(LS, ouser, patch)
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// DoLogin provides a mock function with given fields: c, id, password
func (_m *LdapInterface) DoLogin(c *request.Context, id string, password string) (*model.User, *model.AppError) {
ret := _m.Called(c, id, password)
var r0 *model.User
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(*request.Context, string, string) (*model.User, *model.AppError)); ok {
return rf(c, id, password)
}
if rf, ok := ret.Get(0).(func(*request.Context, string, string) *model.User); ok {
r0 = rf(c, id, password)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(*request.Context, string, string) *model.AppError); ok {
r1 = rf(c, id, password)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// FirstLoginSync provides a mock function with given fields: c, user, userAuthService, userAuthData, email
func (_m *LdapInterface) FirstLoginSync(c *request.Context, user *model.User, userAuthService string, userAuthData string, email string) *model.AppError {
ret := _m.Called(c, user, userAuthService, userAuthData, email)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(*request.Context, *model.User, string, string, string) *model.AppError); ok {
r0 = rf(c, user, userAuthService, userAuthData, email)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GetADLdapIdFromSAMLId provides a mock function with given fields: authData
func (_m *LdapInterface) GetADLdapIdFromSAMLId(authData string) string {
ret := _m.Called(authData)
var r0 string
if rf, ok := ret.Get(0).(func(string) string); ok {
r0 = rf(authData)
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// GetAllGroupsPage provides a mock function with given fields: page, perPage, opts
func (_m *LdapInterface) GetAllGroupsPage(page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError) {
ret := _m.Called(page, perPage, opts)
var r0 []*model.Group
var r1 int
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(int, int, model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)); ok {
return rf(page, perPage, opts)
}
if rf, ok := ret.Get(0).(func(int, int, model.LdapGroupSearchOpts) []*model.Group); ok {
r0 = rf(page, perPage, opts)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Group)
}
}
if rf, ok := ret.Get(1).(func(int, int, model.LdapGroupSearchOpts) int); ok {
r1 = rf(page, perPage, opts)
} else {
r1 = ret.Get(1).(int)
}
if rf, ok := ret.Get(2).(func(int, int, model.LdapGroupSearchOpts) *model.AppError); ok {
r2 = rf(page, perPage, opts)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// GetAllLdapUsers provides a mock function with given fields:
func (_m *LdapInterface) GetAllLdapUsers() ([]*model.User, *model.AppError) {
ret := _m.Called()
var r0 []*model.User
var r1 *model.AppError
if rf, ok := ret.Get(0).(func() ([]*model.User, *model.AppError)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() []*model.User); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.User)
}
}
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
r1 = rf()
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetGroup provides a mock function with given fields: groupUID
func (_m *LdapInterface) GetGroup(groupUID string) (*model.Group, *model.AppError) {
ret := _m.Called(groupUID)
var r0 *model.Group
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string) (*model.Group, *model.AppError)); ok {
return rf(groupUID)
}
if rf, ok := ret.Get(0).(func(string) *model.Group); ok {
r0 = rf(groupUID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Group)
}
}
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(groupUID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetSAMLIdFromADLdapId provides a mock function with given fields: authData
func (_m *LdapInterface) GetSAMLIdFromADLdapId(authData string) string {
ret := _m.Called(authData)
var r0 string
if rf, ok := ret.Get(0).(func(string) string); ok {
r0 = rf(authData)
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// GetUser provides a mock function with given fields: id
func (_m *LdapInterface) GetUser(id string) (*model.User, *model.AppError) {
ret := _m.Called(id)
var r0 *model.User
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string) (*model.User, *model.AppError)); ok {
return rf(id)
}
if rf, ok := ret.Get(0).(func(string) *model.User); ok {
r0 = rf(id)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(id)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetUserAttributes provides a mock function with given fields: id, attributes
func (_m *LdapInterface) GetUserAttributes(id string, attributes []string) (map[string]string, *model.AppError) {
ret := _m.Called(id, attributes)
var r0 map[string]string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, []string) (map[string]string, *model.AppError)); ok {
return rf(id, attributes)
}
if rf, ok := ret.Get(0).(func(string, []string) map[string]string); ok {
r0 = rf(id, attributes)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[string]string)
}
}
if rf, ok := ret.Get(1).(func(string, []string) *model.AppError); ok {
r1 = rf(id, attributes)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetVendorNameAndVendorVersion provides a mock function with given fields:
func (_m *LdapInterface) GetVendorNameAndVendorVersion() (string, string) {
ret := _m.Called()
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
}
// MigrateIDAttribute provides a mock function with given fields: toAttribute
func (_m *LdapInterface) MigrateIDAttribute(toAttribute string) error {
ret := _m.Called(toAttribute)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(toAttribute)
} else {
r0 = ret.Error(0)
}
return r0
}
// RunTest provides a mock function with given fields:
func (_m *LdapInterface) RunTest() *model.AppError {
ret := _m.Called()
var r0 *model.AppError
if rf, ok := ret.Get(0).(func() *model.AppError); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// StartSynchronizeJob provides a mock function with given fields: waitForJobToFinish, includeRemovedMembers
func (_m *LdapInterface) StartSynchronizeJob(waitForJobToFinish bool, includeRemovedMembers bool) (*model.Job, *model.AppError) {
ret := _m.Called(waitForJobToFinish, includeRemovedMembers)
var r0 *model.Job
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(bool, bool) (*model.Job, *model.AppError)); ok {
return rf(waitForJobToFinish, includeRemovedMembers)
}
if rf, ok := ret.Get(0).(func(bool, bool) *model.Job); ok {
r0 = rf(waitForJobToFinish, includeRemovedMembers)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Job)
}
}
if rf, ok := ret.Get(1).(func(bool, bool) *model.AppError); ok {
r1 = rf(waitForJobToFinish, includeRemovedMembers)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// SwitchToLdap provides a mock function with given fields: userID, ldapID, ldapPassword
func (_m *LdapInterface) SwitchToLdap(userID string, ldapID string, ldapPassword string) *model.AppError {
ret := _m.Called(userID, ldapID, ldapPassword)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, string, string) *model.AppError); ok {
r0 = rf(userID, ldapID, ldapPassword)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// UpdateProfilePictureIfNecessary provides a mock function with given fields: _a0, _a1, _a2
func (_m *LdapInterface) UpdateProfilePictureIfNecessary(_a0 request.CTX, _a1 model.User, _a2 model.Session) {
_m.Called(_a0, _a1, _a2)
}
type mockConstructorTestingTNewLdapInterface interface {
mock.TestingT
Cleanup(func())
}
// NewLdapInterface creates a new instance of LdapInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewLdapInterface(t mockConstructorTestingTNewLdapInterface) *LdapInterface {
mock := &LdapInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,62 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// LdapSyncInterface is an autogenerated mock type for the LdapSyncInterface type
type LdapSyncInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with given fields:
func (_m *LdapSyncInterface) MakeScheduler() model.Scheduler {
ret := _m.Called()
var r0 model.Scheduler
if rf, ok := ret.Get(0).(func() model.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with given fields:
func (_m *LdapSyncInterface) MakeWorker() model.Worker {
ret := _m.Called()
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
type mockConstructorTestingTNewLdapSyncInterface interface {
mock.TestingT
Cleanup(func())
}
// NewLdapSyncInterface creates a new instance of LdapSyncInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewLdapSyncInterface(t mockConstructorTestingTNewLdapSyncInterface) *LdapSyncInterface {
mock := &LdapSyncInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,80 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// LicenseInterface is an autogenerated mock type for the LicenseInterface type
type LicenseInterface struct {
mock.Mock
}
// CanStartTrial provides a mock function with given fields:
func (_m *LicenseInterface) CanStartTrial() (bool, error) {
ret := _m.Called()
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func() (bool, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() bool); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetPrevTrial provides a mock function with given fields:
func (_m *LicenseInterface) GetPrevTrial() (*model.License, error) {
ret := _m.Called()
var r0 *model.License
var r1 error
if rf, ok := ret.Get(0).(func() (*model.License, error)); ok {
return rf()
}
if rf, ok := ret.Get(0).(func() *model.License); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.License)
}
}
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
type mockConstructorTestingTNewLicenseInterface interface {
mock.TestingT
Cleanup(func())
}
// NewLicenseInterface creates a new instance of LicenseInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewLicenseInterface(t mockConstructorTestingTNewLicenseInterface) *LicenseInterface {
mock := &LicenseInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,87 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
model "github.com/mattermost/mattermost-server/server/public/model"
)
// MessageExportInterface is an autogenerated mock type for the MessageExportInterface type
type MessageExportInterface struct {
mock.Mock
}
// RunExport provides a mock function with given fields: format, since, limit
func (_m *MessageExportInterface) RunExport(format string, since int64, limit int) (int64, *model.AppError) {
ret := _m.Called(format, since, limit)
var r0 int64
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, int64, int) (int64, *model.AppError)); ok {
return rf(format, since, limit)
}
if rf, ok := ret.Get(0).(func(string, int64, int) int64); ok {
r0 = rf(format, since, limit)
} else {
r0 = ret.Get(0).(int64)
}
if rf, ok := ret.Get(1).(func(string, int64, int) *model.AppError); ok {
r1 = rf(format, since, limit)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// StartSynchronizeJob provides a mock function with given fields: ctx, exportFromTimestamp
func (_m *MessageExportInterface) StartSynchronizeJob(ctx context.Context, exportFromTimestamp int64) (*model.Job, *model.AppError) {
ret := _m.Called(ctx, exportFromTimestamp)
var r0 *model.Job
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(context.Context, int64) (*model.Job, *model.AppError)); ok {
return rf(ctx, exportFromTimestamp)
}
if rf, ok := ret.Get(0).(func(context.Context, int64) *model.Job); ok {
r0 = rf(ctx, exportFromTimestamp)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Job)
}
}
if rf, ok := ret.Get(1).(func(context.Context, int64) *model.AppError); ok {
r1 = rf(ctx, exportFromTimestamp)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
type mockConstructorTestingTNewMessageExportInterface interface {
mock.TestingT
Cleanup(func())
}
// NewMessageExportInterface creates a new instance of MessageExportInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewMessageExportInterface(t mockConstructorTestingTNewMessageExportInterface) *MessageExportInterface {
mock := &MessageExportInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,62 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// MessageExportJobInterface is an autogenerated mock type for the MessageExportJobInterface type
type MessageExportJobInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with given fields:
func (_m *MessageExportJobInterface) MakeScheduler() model.Scheduler {
ret := _m.Called()
var r0 model.Scheduler
if rf, ok := ret.Get(0).(func() model.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with given fields:
func (_m *MessageExportJobInterface) MakeWorker() model.Worker {
ret := _m.Called()
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}
type mockConstructorTestingTNewMessageExportJobInterface interface {
mock.TestingT
Cleanup(func())
}
// NewMessageExportJobInterface creates a new instance of MessageExportJobInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewMessageExportJobInterface(t mockConstructorTestingTNewMessageExportJobInterface) *MessageExportJobInterface {
mock := &MessageExportJobInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

340
server/einterfaces/mocks/MetricsInterface.go Обычный файл
Просмотреть файл

@@ -0,0 +1,340 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
logr "github.com/mattermost/logr/v2"
mock "github.com/stretchr/testify/mock"
model "github.com/mattermost/mattermost-server/server/public/model"
sql "database/sql"
)
// MetricsInterface is an autogenerated mock type for the MetricsInterface type
type MetricsInterface struct {
mock.Mock
}
// AddMemCacheHitCounter provides a mock function with given fields: cacheName, amount
func (_m *MetricsInterface) AddMemCacheHitCounter(cacheName string, amount float64) {
_m.Called(cacheName, amount)
}
// AddMemCacheMissCounter provides a mock function with given fields: cacheName, amount
func (_m *MetricsInterface) AddMemCacheMissCounter(cacheName string, amount float64) {
_m.Called(cacheName, amount)
}
// DecrementJobActive provides a mock function with given fields: jobType
func (_m *MetricsInterface) DecrementJobActive(jobType string) {
_m.Called(jobType)
}
// DecrementWebSocketBroadcastBufferSize provides a mock function with given fields: hub, amount
func (_m *MetricsInterface) DecrementWebSocketBroadcastBufferSize(hub string, amount float64) {
_m.Called(hub, amount)
}
// DecrementWebSocketBroadcastUsersRegistered provides a mock function with given fields: hub, amount
func (_m *MetricsInterface) DecrementWebSocketBroadcastUsersRegistered(hub string, amount float64) {
_m.Called(hub, amount)
}
// GetLoggerMetricsCollector provides a mock function with given fields:
func (_m *MetricsInterface) GetLoggerMetricsCollector() logr.MetricsCollector {
ret := _m.Called()
var r0 logr.MetricsCollector
if rf, ok := ret.Get(0).(func() logr.MetricsCollector); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(logr.MetricsCollector)
}
}
return r0
}
// IncrementChannelIndexCounter provides a mock function with given fields:
func (_m *MetricsInterface) IncrementChannelIndexCounter() {
_m.Called()
}
// IncrementClusterEventType provides a mock function with given fields: eventType
func (_m *MetricsInterface) IncrementClusterEventType(eventType model.ClusterEvent) {
_m.Called(eventType)
}
// IncrementClusterRequest provides a mock function with given fields:
func (_m *MetricsInterface) IncrementClusterRequest() {
_m.Called()
}
// IncrementEtagHitCounter provides a mock function with given fields: route
func (_m *MetricsInterface) IncrementEtagHitCounter(route string) {
_m.Called(route)
}
// IncrementEtagMissCounter provides a mock function with given fields: route
func (_m *MetricsInterface) IncrementEtagMissCounter(route string) {
_m.Called(route)
}
// IncrementFileIndexCounter provides a mock function with given fields:
func (_m *MetricsInterface) IncrementFileIndexCounter() {
_m.Called()
}
// IncrementFilesSearchCounter provides a mock function with given fields:
func (_m *MetricsInterface) IncrementFilesSearchCounter() {
_m.Called()
}
// IncrementHTTPError provides a mock function with given fields:
func (_m *MetricsInterface) IncrementHTTPError() {
_m.Called()
}
// IncrementHTTPRequest provides a mock function with given fields:
func (_m *MetricsInterface) IncrementHTTPRequest() {
_m.Called()
}
// IncrementJobActive provides a mock function with given fields: jobType
func (_m *MetricsInterface) IncrementJobActive(jobType string) {
_m.Called(jobType)
}
// IncrementLogin provides a mock function with given fields:
func (_m *MetricsInterface) IncrementLogin() {
_m.Called()
}
// IncrementLoginFail provides a mock function with given fields:
func (_m *MetricsInterface) IncrementLoginFail() {
_m.Called()
}
// IncrementMemCacheHitCounter provides a mock function with given fields: cacheName
func (_m *MetricsInterface) IncrementMemCacheHitCounter(cacheName string) {
_m.Called(cacheName)
}
// IncrementMemCacheHitCounterSession provides a mock function with given fields:
func (_m *MetricsInterface) IncrementMemCacheHitCounterSession() {
_m.Called()
}
// IncrementMemCacheInvalidationCounter provides a mock function with given fields: cacheName
func (_m *MetricsInterface) IncrementMemCacheInvalidationCounter(cacheName string) {
_m.Called(cacheName)
}
// IncrementMemCacheInvalidationCounterSession provides a mock function with given fields:
func (_m *MetricsInterface) IncrementMemCacheInvalidationCounterSession() {
_m.Called()
}
// IncrementMemCacheMissCounter provides a mock function with given fields: cacheName
func (_m *MetricsInterface) IncrementMemCacheMissCounter(cacheName string) {
_m.Called(cacheName)
}
// IncrementMemCacheMissCounterSession provides a mock function with given fields:
func (_m *MetricsInterface) IncrementMemCacheMissCounterSession() {
_m.Called()
}
// IncrementPostBroadcast provides a mock function with given fields:
func (_m *MetricsInterface) IncrementPostBroadcast() {
_m.Called()
}
// IncrementPostCreate provides a mock function with given fields:
func (_m *MetricsInterface) IncrementPostCreate() {
_m.Called()
}
// IncrementPostFileAttachment provides a mock function with given fields: count
func (_m *MetricsInterface) IncrementPostFileAttachment(count int) {
_m.Called(count)
}
// IncrementPostIndexCounter provides a mock function with given fields:
func (_m *MetricsInterface) IncrementPostIndexCounter() {
_m.Called()
}
// IncrementPostSentEmail provides a mock function with given fields:
func (_m *MetricsInterface) IncrementPostSentEmail() {
_m.Called()
}
// IncrementPostSentPush provides a mock function with given fields:
func (_m *MetricsInterface) IncrementPostSentPush() {
_m.Called()
}
// IncrementPostsSearchCounter provides a mock function with given fields:
func (_m *MetricsInterface) IncrementPostsSearchCounter() {
_m.Called()
}
// IncrementRemoteClusterConnStateChangeCounter provides a mock function with given fields: remoteID, online
func (_m *MetricsInterface) IncrementRemoteClusterConnStateChangeCounter(remoteID string, online bool) {
_m.Called(remoteID, online)
}
// IncrementRemoteClusterMsgErrorsCounter provides a mock function with given fields: remoteID, timeout
func (_m *MetricsInterface) IncrementRemoteClusterMsgErrorsCounter(remoteID string, timeout bool) {
_m.Called(remoteID, timeout)
}
// IncrementRemoteClusterMsgReceivedCounter provides a mock function with given fields: remoteID
func (_m *MetricsInterface) IncrementRemoteClusterMsgReceivedCounter(remoteID string) {
_m.Called(remoteID)
}
// IncrementRemoteClusterMsgSentCounter provides a mock function with given fields: remoteID
func (_m *MetricsInterface) IncrementRemoteClusterMsgSentCounter(remoteID string) {
_m.Called(remoteID)
}
// IncrementUserIndexCounter provides a mock function with given fields:
func (_m *MetricsInterface) IncrementUserIndexCounter() {
_m.Called()
}
// IncrementWebSocketBroadcast provides a mock function with given fields: eventType
func (_m *MetricsInterface) IncrementWebSocketBroadcast(eventType string) {
_m.Called(eventType)
}
// IncrementWebSocketBroadcastBufferSize provides a mock function with given fields: hub, amount
func (_m *MetricsInterface) IncrementWebSocketBroadcastBufferSize(hub string, amount float64) {
_m.Called(hub, amount)
}
// IncrementWebSocketBroadcastUsersRegistered provides a mock function with given fields: hub, amount
func (_m *MetricsInterface) IncrementWebSocketBroadcastUsersRegistered(hub string, amount float64) {
_m.Called(hub, amount)
}
// IncrementWebhookPost provides a mock function with given fields:
func (_m *MetricsInterface) IncrementWebhookPost() {
_m.Called()
}
// IncrementWebsocketEvent provides a mock function with given fields: eventType
func (_m *MetricsInterface) IncrementWebsocketEvent(eventType string) {
_m.Called(eventType)
}
// IncrementWebsocketReconnectEvent provides a mock function with given fields: eventType
func (_m *MetricsInterface) IncrementWebsocketReconnectEvent(eventType string) {
_m.Called(eventType)
}
// ObserveAPIEndpointDuration provides a mock function with given fields: endpoint, method, statusCode, elapsed
func (_m *MetricsInterface) ObserveAPIEndpointDuration(endpoint string, method string, statusCode string, elapsed float64) {
_m.Called(endpoint, method, statusCode, elapsed)
}
// ObserveClusterRequestDuration provides a mock function with given fields: elapsed
func (_m *MetricsInterface) ObserveClusterRequestDuration(elapsed float64) {
_m.Called(elapsed)
}
// ObserveEnabledUsers provides a mock function with given fields: users
func (_m *MetricsInterface) ObserveEnabledUsers(users int64) {
_m.Called(users)
}
// ObserveFilesSearchDuration provides a mock function with given fields: elapsed
func (_m *MetricsInterface) ObserveFilesSearchDuration(elapsed float64) {
_m.Called(elapsed)
}
// ObservePluginAPIDuration provides a mock function with given fields: pluginID, apiName, success, elapsed
func (_m *MetricsInterface) ObservePluginAPIDuration(pluginID string, apiName string, success bool, elapsed float64) {
_m.Called(pluginID, apiName, success, elapsed)
}
// ObservePluginHookDuration provides a mock function with given fields: pluginID, hookName, success, elapsed
func (_m *MetricsInterface) ObservePluginHookDuration(pluginID string, hookName string, success bool, elapsed float64) {
_m.Called(pluginID, hookName, success, elapsed)
}
// ObservePluginMultiHookDuration provides a mock function with given fields: elapsed
func (_m *MetricsInterface) ObservePluginMultiHookDuration(elapsed float64) {
_m.Called(elapsed)
}
// ObservePluginMultiHookIterationDuration provides a mock function with given fields: pluginID, elapsed
func (_m *MetricsInterface) ObservePluginMultiHookIterationDuration(pluginID string, elapsed float64) {
_m.Called(pluginID, elapsed)
}
// ObservePostsSearchDuration provides a mock function with given fields: elapsed
func (_m *MetricsInterface) ObservePostsSearchDuration(elapsed float64) {
_m.Called(elapsed)
}
// ObserveRemoteClusterClockSkew provides a mock function with given fields: remoteID, skew
func (_m *MetricsInterface) ObserveRemoteClusterClockSkew(remoteID string, skew float64) {
_m.Called(remoteID, skew)
}
// ObserveRemoteClusterPingDuration provides a mock function with given fields: remoteID, elapsed
func (_m *MetricsInterface) ObserveRemoteClusterPingDuration(remoteID string, elapsed float64) {
_m.Called(remoteID, elapsed)
}
// ObserveStoreMethodDuration provides a mock function with given fields: method, success, elapsed
func (_m *MetricsInterface) ObserveStoreMethodDuration(method string, success string, elapsed float64) {
_m.Called(method, success, elapsed)
}
// Register provides a mock function with given fields:
func (_m *MetricsInterface) Register() {
_m.Called()
}
// RegisterDBCollector provides a mock function with given fields: db, name
func (_m *MetricsInterface) RegisterDBCollector(db *sql.DB, name string) {
_m.Called(db, name)
}
// SetReplicaLagAbsolute provides a mock function with given fields: node, value
func (_m *MetricsInterface) SetReplicaLagAbsolute(node string, value float64) {
_m.Called(node, value)
}
// SetReplicaLagTime provides a mock function with given fields: node, value
func (_m *MetricsInterface) SetReplicaLagTime(node string, value float64) {
_m.Called(node, value)
}
// UnregisterDBCollector provides a mock function with given fields: db, name
func (_m *MetricsInterface) UnregisterDBCollector(db *sql.DB, name string) {
_m.Called(db, name)
}
type mockConstructorTestingTNewMetricsInterface interface {
mock.TestingT
Cleanup(func())
}
// NewMetricsInterface creates a new instance of MetricsInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewMetricsInterface(t mockConstructorTestingTNewMetricsInterface) *MetricsInterface {
mock := &MetricsInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

123
server/einterfaces/mocks/MfaInterface.go Обычный файл
Просмотреть файл

@@ -0,0 +1,123 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// MfaInterface is an autogenerated mock type for the MfaInterface type
type MfaInterface struct {
mock.Mock
}
// Activate provides a mock function with given fields: user, token
func (_m *MfaInterface) Activate(user *model.User, token string) *model.AppError {
ret := _m.Called(user, token)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(*model.User, string) *model.AppError); ok {
r0 = rf(user, token)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// Deactivate provides a mock function with given fields: userID
func (_m *MfaInterface) Deactivate(userID string) *model.AppError {
ret := _m.Called(userID)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
r0 = rf(userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GenerateSecret provides a mock function with given fields: user
func (_m *MfaInterface) GenerateSecret(user *model.User) (string, []byte, *model.AppError) {
ret := _m.Called(user)
var r0 string
var r1 []byte
var r2 *model.AppError
if rf, ok := ret.Get(0).(func(*model.User) (string, []byte, *model.AppError)); ok {
return rf(user)
}
if rf, ok := ret.Get(0).(func(*model.User) string); ok {
r0 = rf(user)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(*model.User) []byte); ok {
r1 = rf(user)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).([]byte)
}
}
if rf, ok := ret.Get(2).(func(*model.User) *model.AppError); ok {
r2 = rf(user)
} else {
if ret.Get(2) != nil {
r2 = ret.Get(2).(*model.AppError)
}
}
return r0, r1, r2
}
// ValidateToken provides a mock function with given fields: secret, token
func (_m *MfaInterface) ValidateToken(secret string, token string) (bool, *model.AppError) {
ret := _m.Called(secret, token)
var r0 bool
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string, string) (bool, *model.AppError)); ok {
return rf(secret, token)
}
if rf, ok := ret.Get(0).(func(string, string) bool); ok {
r0 = rf(secret, token)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
r1 = rf(secret, token)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
type mockConstructorTestingTNewMfaInterface interface {
mock.TestingT
Cleanup(func())
}
// NewMfaInterface creates a new instance of MfaInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewMfaInterface(t mockConstructorTestingTNewMfaInterface) *MfaInterface {
mock := &MfaInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,74 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// NotificationInterface is an autogenerated mock type for the NotificationInterface type
type NotificationInterface struct {
mock.Mock
}
// CheckLicense provides a mock function with given fields:
func (_m *NotificationInterface) CheckLicense() *model.AppError {
ret := _m.Called()
var r0 *model.AppError
if rf, ok := ret.Get(0).(func() *model.AppError); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
}
return r0
}
// GetNotificationMessage provides a mock function with given fields: ack, userID
func (_m *NotificationInterface) GetNotificationMessage(ack *model.PushNotificationAck, userID string) (*model.PushNotification, *model.AppError) {
ret := _m.Called(ack, userID)
var r0 *model.PushNotification
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(*model.PushNotificationAck, string) (*model.PushNotification, *model.AppError)); ok {
return rf(ack, userID)
}
if rf, ok := ret.Get(0).(func(*model.PushNotificationAck, string) *model.PushNotification); ok {
r0 = rf(ack, userID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.PushNotification)
}
}
if rf, ok := ret.Get(1).(func(*model.PushNotificationAck, string) *model.AppError); ok {
r1 = rf(ack, userID)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
type mockConstructorTestingTNewNotificationInterface interface {
mock.TestingT
Cleanup(func())
}
// NewNotificationInterface creates a new instance of NotificationInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewNotificationInterface(t mockConstructorTestingTNewNotificationInterface) *NotificationInterface {
mock := &NotificationInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

124
server/einterfaces/mocks/OAuthProvider.go Обычный файл
Просмотреть файл

@@ -0,0 +1,124 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
io "io"
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// OAuthProvider is an autogenerated mock type for the OAuthProvider type
type OAuthProvider struct {
mock.Mock
}
// GetSSOSettings provides a mock function with given fields: config, service
func (_m *OAuthProvider) GetSSOSettings(config *model.Config, service string) (*model.SSOSettings, error) {
ret := _m.Called(config, service)
var r0 *model.SSOSettings
var r1 error
if rf, ok := ret.Get(0).(func(*model.Config, string) (*model.SSOSettings, error)); ok {
return rf(config, service)
}
if rf, ok := ret.Get(0).(func(*model.Config, string) *model.SSOSettings); ok {
r0 = rf(config, service)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SSOSettings)
}
}
if rf, ok := ret.Get(1).(func(*model.Config, string) error); ok {
r1 = rf(config, service)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetUserFromIdToken provides a mock function with given fields: idToken
func (_m *OAuthProvider) GetUserFromIdToken(idToken string) (*model.User, error) {
ret := _m.Called(idToken)
var r0 *model.User
var r1 error
if rf, ok := ret.Get(0).(func(string) (*model.User, error)); ok {
return rf(idToken)
}
if rf, ok := ret.Get(0).(func(string) *model.User); ok {
r0 = rf(idToken)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(idToken)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetUserFromJSON provides a mock function with given fields: data, tokenUser
func (_m *OAuthProvider) GetUserFromJSON(data io.Reader, tokenUser *model.User) (*model.User, error) {
ret := _m.Called(data, tokenUser)
var r0 *model.User
var r1 error
if rf, ok := ret.Get(0).(func(io.Reader, *model.User) (*model.User, error)); ok {
return rf(data, tokenUser)
}
if rf, ok := ret.Get(0).(func(io.Reader, *model.User) *model.User); ok {
r0 = rf(data, tokenUser)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(io.Reader, *model.User) error); ok {
r1 = rf(data, tokenUser)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IsSameUser provides a mock function with given fields: dbUser, oAuthUser
func (_m *OAuthProvider) IsSameUser(dbUser *model.User, oAuthUser *model.User) bool {
ret := _m.Called(dbUser, oAuthUser)
var r0 bool
if rf, ok := ret.Get(0).(func(*model.User, *model.User) bool); ok {
r0 = rf(dbUser, oAuthUser)
} else {
r0 = ret.Get(0).(bool)
}
return r0
}
type mockConstructorTestingTNewOAuthProvider interface {
mock.TestingT
Cleanup(func())
}
// NewOAuthProvider creates a new instance of OAuthProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewOAuthProvider(t mockConstructorTestingTNewOAuthProvider) *OAuthProvider {
mock := &OAuthProvider{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

Просмотреть файл

@@ -0,0 +1,47 @@
// Code generated by mockery v1.0.0. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
mock "github.com/stretchr/testify/mock"
)
// ResendInvitationEmailJobInterface is an autogenerated mock type for the ResendInvitationEmailJobInterface type
type ResendInvitationEmailJobInterface struct {
mock.Mock
}
// MakeScheduler provides a mock function with given fields:
func (_m *ResendInvitationEmailJobInterface) MakeScheduler() model.Scheduler {
ret := _m.Called()
var r0 model.Scheduler
if rf, ok := ret.Get(0).(func() model.Scheduler); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Scheduler)
}
}
return r0
}
// MakeWorker provides a mock function with given fields:
func (_m *ResendInvitationEmailJobInterface) MakeWorker() model.Worker {
ret := _m.Called()
var r0 model.Worker
if rf, ok := ret.Get(0).(func() model.Worker); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(model.Worker)
}
}
return r0
}

141
server/einterfaces/mocks/SamlInterface.go Обычный файл
Просмотреть файл

@@ -0,0 +1,141 @@
// Code generated by mockery v2.23.2. DO NOT EDIT.
// Regenerate this file using `make einterfaces-mocks`.
package mocks
import (
model "github.com/mattermost/mattermost-server/server/public/model"
request "github.com/mattermost/mattermost-server/server/v8/channels/app/request"
mock "github.com/stretchr/testify/mock"
)
// SamlInterface is an autogenerated mock type for the SamlInterface type
type SamlInterface struct {
mock.Mock
}
// BuildRequest provides a mock function with given fields: relayState
func (_m *SamlInterface) BuildRequest(relayState string) (*model.SamlAuthRequest, *model.AppError) {
ret := _m.Called(relayState)
var r0 *model.SamlAuthRequest
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(string) (*model.SamlAuthRequest, *model.AppError)); ok {
return rf(relayState)
}
if rf, ok := ret.Get(0).(func(string) *model.SamlAuthRequest); ok {
r0 = rf(relayState)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.SamlAuthRequest)
}
}
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(relayState)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// CheckProviderAttributes provides a mock function with given fields: SS, ouser, patch
func (_m *SamlInterface) CheckProviderAttributes(SS *model.SamlSettings, ouser *model.User, patch *model.UserPatch) string {
ret := _m.Called(SS, ouser, patch)
var r0 string
if rf, ok := ret.Get(0).(func(*model.SamlSettings, *model.User, *model.UserPatch) string); ok {
r0 = rf(SS, ouser, patch)
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// ConfigureSP provides a mock function with given fields:
func (_m *SamlInterface) ConfigureSP() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// DoLogin provides a mock function with given fields: c, encodedXML, relayState
func (_m *SamlInterface) DoLogin(c *request.Context, encodedXML string, relayState map[string]string) (*model.User, *model.AppError) {
ret := _m.Called(c, encodedXML, relayState)
var r0 *model.User
var r1 *model.AppError
if rf, ok := ret.Get(0).(func(*request.Context, string, map[string]string) (*model.User, *model.AppError)); ok {
return rf(c, encodedXML, relayState)
}
if rf, ok := ret.Get(0).(func(*request.Context, string, map[string]string) *model.User); ok {
r0 = rf(c, encodedXML, relayState)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.User)
}
}
if rf, ok := ret.Get(1).(func(*request.Context, string, map[string]string) *model.AppError); ok {
r1 = rf(c, encodedXML, relayState)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetMetadata provides a mock function with given fields:
func (_m *SamlInterface) GetMetadata() (string, *model.AppError) {
ret := _m.Called()
var r0 string
var r1 *model.AppError
if rf, ok := ret.Get(0).(func() (string, *model.AppError)); 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() *model.AppError); ok {
r1 = rf()
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
type mockConstructorTestingTNewSamlInterface interface {
mock.TestingT
Cleanup(func())
}
// NewSamlInterface creates a new instance of SamlInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewSamlInterface(t mockConstructorTestingTNewSamlInterface) *SamlInterface {
mock := &SamlInterface{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}

13
server/einterfaces/notification.go Обычный файл
Просмотреть файл

@@ -0,0 +1,13 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost-server/server/public/model"
)
type NotificationInterface interface {
GetNotificationMessage(ack *model.PushNotificationAck, userID string) (*model.PushNotification, *model.AppError)
CheckLicense() *model.AppError
}

31
server/einterfaces/oauthproviders.go Обычный файл
Просмотреть файл

@@ -0,0 +1,31 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"io"
"github.com/mattermost/mattermost-server/server/public/model"
)
type OAuthProvider interface {
GetUserFromJSON(data io.Reader, tokenUser *model.User) (*model.User, error)
GetSSOSettings(config *model.Config, service string) (*model.SSOSettings, error)
GetUserFromIdToken(idToken string) (*model.User, error)
IsSameUser(dbUser, oAuthUser *model.User) bool
}
var oauthProviders = make(map[string]OAuthProvider)
func RegisterOAuthProvider(name string, newProvider OAuthProvider) {
oauthProviders[name] = newProvider
}
func GetOAuthProvider(name string) OAuthProvider {
provider, ok := oauthProviders[name]
if ok {
return provider
}
return nil
}

17
server/einterfaces/saml.go Обычный файл
Просмотреть файл

@@ -0,0 +1,17 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package einterfaces
import (
"github.com/mattermost/mattermost-server/server/public/model"
"github.com/mattermost/mattermost-server/server/v8/channels/app/request"
)
type SamlInterface interface {
ConfigureSP() error
BuildRequest(relayState string) (*model.SamlAuthRequest, *model.AppError)
DoLogin(c *request.Context, encodedXML string, relayState map[string]string) (*model.User, *model.AppError)
GetMetadata() (string, *model.AppError)
CheckProviderAttributes(SS *model.SamlSettings, ouser *model.User, patch *model.UserPatch) string
}