mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-16543 Fix Elasticsearch only returning one page of results (#11528)
* MM-16543 Add mocking for einterfaces packages * MM-16543 Fix Elasticsearch only returning one page of results * Remove license checks for einterface mocks
This commit is contained in:
committed by
Christopher Speller
parent
c0b51b03de
commit
673ed02a0d
4
Makefile
4
Makefile
@@ -347,6 +347,10 @@ plugin-mocks: ## Creates mock files for plugins.
|
||||
$(GOPATH)/bin/mockery -dir plugin -name Hooks -output plugin/plugintest -outpkg plugintest -case underscore -note 'Regenerate this file using `make plugin-mocks`.'
|
||||
$(GOPATH)/bin/mockery -dir plugin -name Helpers -output plugin/plugintest -outpkg plugintest -case underscore -note 'Regenerate this file using `make plugin-mocks`.'
|
||||
|
||||
einterfaces-mocks: ## Creates mock files for einterfaces.
|
||||
env GO111MODULE=off go get -u github.com/vektra/mockery/...
|
||||
$(GOPATH)/bin/mockery -dir einterfaces -all -output einterfaces/mocks -note 'Regenerate this file using `make einterfaces-mocks`.'
|
||||
|
||||
pluginapi: ## Generates api and hooks glue code for plugins
|
||||
go generate ./plugin
|
||||
|
||||
|
||||
18
app/post.go
18
app/post.go
@@ -1012,6 +1012,10 @@ func (a *App) SearchPostsInTeamForUser(terms string, userId string, teamId strin
|
||||
var err *model.AppError
|
||||
paramsList := model.ParseSearchParams(strings.TrimSpace(terms), timeZoneOffset)
|
||||
|
||||
if !*a.Config().ServiceSettings.EnablePostSearch {
|
||||
return nil, model.NewAppError("SearchPostsInTeamForUser", "store.sql_post.search.disabled", nil, fmt.Sprintf("teamId=%v userId=%v", teamId, userId), http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
if a.IsESSearchEnabled() {
|
||||
postSearchResults, err = a.esSearchPostsInTeamForUser(paramsList, userId, teamId, isOrSearch, includeDeletedChannels, page, perPage)
|
||||
if err != nil {
|
||||
@@ -1019,16 +1023,12 @@ func (a *App) SearchPostsInTeamForUser(terms string, userId string, teamId strin
|
||||
}
|
||||
}
|
||||
|
||||
if !*a.Config().ServiceSettings.EnablePostSearch {
|
||||
return nil, model.NewAppError("SearchPostsInTeamForUser", "store.sql_post.search.disabled", nil, fmt.Sprintf("teamId=%v userId=%v", teamId, userId), http.StatusNotImplemented)
|
||||
}
|
||||
|
||||
// Since we don't support paging we just return nothing for later pages
|
||||
if page > 0 {
|
||||
return model.MakePostSearchResults(model.NewPostList(), nil), nil
|
||||
}
|
||||
|
||||
if !a.IsESSearchEnabled() || err != nil {
|
||||
// Since we don't support paging for DB search, we just return nothing for later pages
|
||||
if page > 0 {
|
||||
return model.MakePostSearchResults(model.NewPostList(), nil), nil
|
||||
}
|
||||
|
||||
includeDeleted := includeDeletedChannels && *a.Config().TeamSettings.ExperimentalViewArchivedChannels
|
||||
posts, err := a.searchPostsInTeam(teamId, userId, paramsList, func(params *model.SearchParams) {
|
||||
params.IncludeDeletedChannels = includeDeleted
|
||||
|
||||
158
app/post_test.go
158
app/post_test.go
@@ -13,7 +13,9 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mattermost/mattermost-server/einterfaces/mocks"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/plugin/plugintest/mock"
|
||||
"github.com/mattermost/mattermost-server/store/storetest"
|
||||
)
|
||||
|
||||
@@ -772,3 +774,159 @@ func TestUpdatePost(t *testing.T) {
|
||||
assert.Equal(t, "", rpost.Message)
|
||||
})
|
||||
}
|
||||
|
||||
func TestSearchPostsInTeamForUser(t *testing.T) {
|
||||
perPage := 5
|
||||
searchTerm := "searchTerm"
|
||||
|
||||
setup := func(t *testing.T, enableElasticsearch bool) (*TestHelper, []*model.Post) {
|
||||
th := Setup(t).InitBasic()
|
||||
|
||||
posts := make([]*model.Post, 7)
|
||||
for i := 0; i < cap(posts); i++ {
|
||||
post, err := th.App.CreatePost(&model.Post{
|
||||
UserId: th.BasicUser.Id,
|
||||
ChannelId: th.BasicChannel.Id,
|
||||
Message: searchTerm,
|
||||
}, th.BasicChannel, false)
|
||||
|
||||
require.Nil(t, err)
|
||||
|
||||
posts[i] = post
|
||||
}
|
||||
|
||||
if enableElasticsearch {
|
||||
th.App.SetLicense(model.NewTestLicense("elastic_search"))
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ElasticsearchSettings.EnableIndexing = true
|
||||
*cfg.ElasticsearchSettings.EnableSearching = true
|
||||
})
|
||||
} else {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ElasticsearchSettings.EnableSearching = false
|
||||
})
|
||||
}
|
||||
|
||||
return th, posts
|
||||
}
|
||||
|
||||
t.Run("should return everything as first page of posts from database", func(t *testing.T) {
|
||||
th, posts := setup(t, false)
|
||||
defer th.TearDown()
|
||||
|
||||
page := 0
|
||||
|
||||
results, err := th.App.SearchPostsInTeamForUser(searchTerm, th.BasicUser.Id, th.BasicTeam.Id, false, false, 0, page, perPage)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, []string{
|
||||
posts[6].Id,
|
||||
posts[5].Id,
|
||||
posts[4].Id,
|
||||
posts[3].Id,
|
||||
posts[2].Id,
|
||||
posts[1].Id,
|
||||
posts[0].Id,
|
||||
}, results.Order)
|
||||
})
|
||||
|
||||
t.Run("should not return later pages of posts from database", func(t *testing.T) {
|
||||
th, _ := setup(t, false)
|
||||
defer th.TearDown()
|
||||
|
||||
page := 1
|
||||
|
||||
results, err := th.App.SearchPostsInTeamForUser(searchTerm, th.BasicUser.Id, th.BasicTeam.Id, false, false, 0, page, perPage)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, []string{}, results.Order)
|
||||
})
|
||||
|
||||
t.Run("should return first page of posts from ElasticSearch", func(t *testing.T) {
|
||||
th, posts := setup(t, true)
|
||||
defer th.TearDown()
|
||||
|
||||
page := 0
|
||||
resultsPage := []string{
|
||||
posts[6].Id,
|
||||
posts[5].Id,
|
||||
posts[4].Id,
|
||||
posts[3].Id,
|
||||
posts[2].Id,
|
||||
}
|
||||
|
||||
es := &mocks.ElasticsearchInterface{}
|
||||
es.On("SearchPosts", mock.Anything, mock.Anything, page, perPage).Return(resultsPage, nil, nil)
|
||||
th.App.Elasticsearch = es
|
||||
|
||||
results, err := th.App.SearchPostsInTeamForUser(searchTerm, th.BasicUser.Id, th.BasicTeam.Id, false, false, 0, page, perPage)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, resultsPage, results.Order)
|
||||
es.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("should return later pages of posts from ElasticSearch", func(t *testing.T) {
|
||||
th, posts := setup(t, true)
|
||||
defer th.TearDown()
|
||||
|
||||
page := 1
|
||||
resultsPage := []string{
|
||||
posts[1].Id,
|
||||
posts[0].Id,
|
||||
}
|
||||
|
||||
es := &mocks.ElasticsearchInterface{}
|
||||
es.On("SearchPosts", mock.Anything, mock.Anything, page, perPage).Return(resultsPage, nil, nil)
|
||||
th.App.Elasticsearch = es
|
||||
|
||||
results, err := th.App.SearchPostsInTeamForUser(searchTerm, th.BasicUser.Id, th.BasicTeam.Id, false, false, 0, page, perPage)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, resultsPage, results.Order)
|
||||
es.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("should fall back to database if ElasticSearch fails on first page", func(t *testing.T) {
|
||||
th, posts := setup(t, true)
|
||||
defer th.TearDown()
|
||||
|
||||
page := 0
|
||||
|
||||
es := &mocks.ElasticsearchInterface{}
|
||||
es.On("SearchPosts", mock.Anything, mock.Anything, page, perPage).Return(nil, nil, &model.AppError{})
|
||||
th.App.Elasticsearch = es
|
||||
|
||||
results, err := th.App.SearchPostsInTeamForUser(searchTerm, th.BasicUser.Id, th.BasicTeam.Id, false, false, 0, page, perPage)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, []string{
|
||||
posts[6].Id,
|
||||
posts[5].Id,
|
||||
posts[4].Id,
|
||||
posts[3].Id,
|
||||
posts[2].Id,
|
||||
posts[1].Id,
|
||||
posts[0].Id,
|
||||
}, results.Order)
|
||||
es.AssertExpectations(t)
|
||||
})
|
||||
|
||||
t.Run("should return nothing if ElasticSearch fails on later pages", func(t *testing.T) {
|
||||
th, _ := setup(t, true)
|
||||
defer th.TearDown()
|
||||
|
||||
page := 1
|
||||
|
||||
es := &mocks.ElasticsearchInterface{}
|
||||
es.On("SearchPosts", mock.Anything, mock.Anything, page, perPage).Return(nil, nil, &model.AppError{})
|
||||
th.App.Elasticsearch = es
|
||||
|
||||
results, err := th.App.SearchPostsInTeamForUser(searchTerm, th.BasicUser.Id, th.BasicTeam.Id, false, false, 0, page, perPage)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, []string{}, results.Order)
|
||||
es.AssertExpectations(t)
|
||||
})
|
||||
}
|
||||
|
||||
45
einterfaces/mocks/AccountMigrationInterface.go
Normal file
45
einterfaces/mocks/AccountMigrationInterface.go
Normal file
@@ -0,0 +1,45 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// AccountMigrationInterface is an autogenerated mock type for the AccountMigrationInterface type
|
||||
type AccountMigrationInterface struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// MigrateToLdap provides a mock function with given fields: fromAuthService, forignUserFieldNameToMatch, force, dryRun
|
||||
func (_m *AccountMigrationInterface) MigrateToLdap(fromAuthService string, forignUserFieldNameToMatch string, force bool, dryRun bool) *model.AppError {
|
||||
ret := _m.Called(fromAuthService, forignUserFieldNameToMatch, force, dryRun)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, string, bool, bool) *model.AppError); ok {
|
||||
r0 = rf(fromAuthService, forignUserFieldNameToMatch, 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
|
||||
}
|
||||
190
einterfaces/mocks/ClusterInterface.go
Normal file
190
einterfaces/mocks/ClusterInterface.go
Normal file
@@ -0,0 +1,190 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import einterfaces "github.com/mattermost/mattermost-server/einterfaces"
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/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
|
||||
if rf, ok := ret.Get(0).(func() []*model.ClusterStats); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*model.ClusterStats)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
if rf, ok := ret.Get(0).(func() model.PluginStatuses); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(model.PluginStatuses)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// RegisterClusterMessageHandler provides a mock function with given fields: event, crm
|
||||
func (_m *ClusterInterface) RegisterClusterMessageHandler(event string, crm einterfaces.ClusterMessageHandler) {
|
||||
_m.Called(event, crm)
|
||||
}
|
||||
|
||||
// SendClusterMessage provides a mock function with given fields: cluster
|
||||
func (_m *ClusterInterface) SendClusterMessage(cluster *model.ClusterMessage) {
|
||||
_m.Called(cluster)
|
||||
}
|
||||
|
||||
// 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()
|
||||
}
|
||||
34
einterfaces/mocks/ComplianceInterface.go
Normal file
34
einterfaces/mocks/ComplianceInterface.go
Normal file
@@ -0,0 +1,34 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// 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()
|
||||
}
|
||||
38
einterfaces/mocks/DataRetentionInterface.go
Normal file
38
einterfaces/mocks/DataRetentionInterface.go
Normal file
@@ -0,0 +1,38 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// DataRetentionInterface is an autogenerated mock type for the DataRetentionInterface type
|
||||
type DataRetentionInterface struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// GetPolicy provides a mock function with given fields:
|
||||
func (_m *DataRetentionInterface) GetPolicy() (*model.DataRetentionPolicy, *model.AppError) {
|
||||
ret := _m.Called()
|
||||
|
||||
var r0 *model.DataRetentionPolicy
|
||||
if rf, ok := ret.Get(0).(func() *model.DataRetentionPolicy); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.DataRetentionPolicy)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
}
|
||||
45
einterfaces/mocks/DataRetentionJobInterface.go
Normal file
45
einterfaces/mocks/DataRetentionJobInterface.go
Normal file
@@ -0,0 +1,45 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// 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
|
||||
}
|
||||
45
einterfaces/mocks/ElasticsearchAggregatorInterface.go
Normal file
45
einterfaces/mocks/ElasticsearchAggregatorInterface.go
Normal file
@@ -0,0 +1,45 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// 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
|
||||
}
|
||||
29
einterfaces/mocks/ElasticsearchIndexerInterface.go
Normal file
29
einterfaces/mocks/ElasticsearchIndexerInterface.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// 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
|
||||
}
|
||||
308
einterfaces/mocks/ElasticsearchInterface.go
Normal file
308
einterfaces/mocks/ElasticsearchInterface.go
Normal file
@@ -0,0 +1,308 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
import time "time"
|
||||
|
||||
// ElasticsearchInterface is an autogenerated mock type for the ElasticsearchInterface type
|
||||
type ElasticsearchInterface struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// DataRetentionDeleteIndexes provides a mock function with given fields: cutoff
|
||||
func (_m *ElasticsearchInterface) DataRetentionDeleteIndexes(cutoff time.Time) *model.AppError {
|
||||
ret := _m.Called(cutoff)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(time.Time) *model.AppError); ok {
|
||||
r0 = rf(cutoff)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// DeleteChannel provides a mock function with given fields: channel
|
||||
func (_m *ElasticsearchInterface) DeleteChannel(channel *model.Channel) *model.AppError {
|
||||
ret := _m.Called(channel)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.Channel) *model.AppError); ok {
|
||||
r0 = rf(channel)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// DeletePost provides a mock function with given fields: post
|
||||
func (_m *ElasticsearchInterface) DeletePost(post *model.Post) *model.AppError {
|
||||
ret := _m.Called(post)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.Post) *model.AppError); ok {
|
||||
r0 = rf(post)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// DeleteUser provides a mock function with given fields: user
|
||||
func (_m *ElasticsearchInterface) DeleteUser(user *model.User) *model.AppError {
|
||||
ret := _m.Called(user)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.User) *model.AppError); ok {
|
||||
r0 = rf(user)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// IndexChannel provides a mock function with given fields: channel
|
||||
func (_m *ElasticsearchInterface) IndexChannel(channel *model.Channel) *model.AppError {
|
||||
ret := _m.Called(channel)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.Channel) *model.AppError); ok {
|
||||
r0 = rf(channel)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// IndexPost provides a mock function with given fields: post, teamId
|
||||
func (_m *ElasticsearchInterface) IndexPost(post *model.Post, teamId string) *model.AppError {
|
||||
ret := _m.Called(post, teamId)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.Post, string) *model.AppError); ok {
|
||||
r0 = rf(post, teamId)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// IndexUser provides a mock function with given fields: user, teamsIds, channelsIds
|
||||
func (_m *ElasticsearchInterface) IndexUser(user *model.User, teamsIds []string, channelsIds []string) *model.AppError {
|
||||
ret := _m.Called(user, teamsIds, channelsIds)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.User, []string, []string) *model.AppError); ok {
|
||||
r0 = rf(user, teamsIds, channelsIds)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// PurgeIndexes provides a mock function with given fields:
|
||||
func (_m *ElasticsearchInterface) PurgeIndexes() *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
|
||||
}
|
||||
|
||||
// SearchChannels provides a mock function with given fields: teamId, term
|
||||
func (_m *ElasticsearchInterface) SearchChannels(teamId string, term string) ([]string, *model.AppError) {
|
||||
ret := _m.Called(teamId, term)
|
||||
|
||||
var r0 []string
|
||||
if rf, ok := ret.Get(0).(func(string, string) []string); ok {
|
||||
r0 = rf(teamId, term)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]string)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
|
||||
r1 = rf(teamId, term)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// SearchPosts provides a mock function with given fields: channels, searchParams, page, perPage
|
||||
func (_m *ElasticsearchInterface) SearchPosts(channels *model.ChannelList, searchParams []*model.SearchParams, page int, perPage int) ([]string, model.PostSearchMatches, *model.AppError) {
|
||||
ret := _m.Called(channels, searchParams, page, perPage)
|
||||
|
||||
var r0 []string
|
||||
if rf, ok := ret.Get(0).(func(*model.ChannelList, []*model.SearchParams, int, int) []string); ok {
|
||||
r0 = rf(channels, searchParams, page, perPage)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]string)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 model.PostSearchMatches
|
||||
if rf, ok := ret.Get(1).(func(*model.ChannelList, []*model.SearchParams, int, int) model.PostSearchMatches); ok {
|
||||
r1 = rf(channels, searchParams, page, perPage)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(model.PostSearchMatches)
|
||||
}
|
||||
}
|
||||
|
||||
var r2 *model.AppError
|
||||
if rf, ok := ret.Get(2).(func(*model.ChannelList, []*model.SearchParams, int, int) *model.AppError); ok {
|
||||
r2 = rf(channels, searchParams, page, perPage)
|
||||
} else {
|
||||
if ret.Get(2) != nil {
|
||||
r2 = ret.Get(2).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1, r2
|
||||
}
|
||||
|
||||
// SearchUsersInChannel provides a mock function with given fields: teamId, channelId, restrictedToChannels, term, options
|
||||
func (_m *ElasticsearchInterface) SearchUsersInChannel(teamId string, channelId string, restrictedToChannels []string, term string, options *model.UserSearchOptions) ([]string, []string, *model.AppError) {
|
||||
ret := _m.Called(teamId, channelId, restrictedToChannels, term, options)
|
||||
|
||||
var r0 []string
|
||||
if rf, ok := ret.Get(0).(func(string, string, []string, string, *model.UserSearchOptions) []string); ok {
|
||||
r0 = rf(teamId, channelId, restrictedToChannels, term, options)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]string)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 []string
|
||||
if rf, ok := ret.Get(1).(func(string, string, []string, string, *model.UserSearchOptions) []string); ok {
|
||||
r1 = rf(teamId, channelId, restrictedToChannels, term, options)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).([]string)
|
||||
}
|
||||
}
|
||||
|
||||
var r2 *model.AppError
|
||||
if rf, ok := ret.Get(2).(func(string, string, []string, string, *model.UserSearchOptions) *model.AppError); ok {
|
||||
r2 = rf(teamId, channelId, restrictedToChannels, term, options)
|
||||
} else {
|
||||
if ret.Get(2) != nil {
|
||||
r2 = ret.Get(2).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1, r2
|
||||
}
|
||||
|
||||
// SearchUsersInTeam provides a mock function with given fields: teamId, restrictedToChannels, term, options
|
||||
func (_m *ElasticsearchInterface) SearchUsersInTeam(teamId string, restrictedToChannels []string, term string, options *model.UserSearchOptions) ([]string, *model.AppError) {
|
||||
ret := _m.Called(teamId, restrictedToChannels, term, options)
|
||||
|
||||
var r0 []string
|
||||
if rf, ok := ret.Get(0).(func(string, []string, string, *model.UserSearchOptions) []string); ok {
|
||||
r0 = rf(teamId, restrictedToChannels, term, options)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]string)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, []string, string, *model.UserSearchOptions) *model.AppError); ok {
|
||||
r1 = rf(teamId, restrictedToChannels, term, options)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Start provides a mock function with given fields:
|
||||
func (_m *ElasticsearchInterface) Start() *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
|
||||
}
|
||||
|
||||
// Stop provides a mock function with given fields:
|
||||
func (_m *ElasticsearchInterface) Stop() *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
|
||||
}
|
||||
|
||||
// TestConfig provides a mock function with given fields: cfg
|
||||
func (_m *ElasticsearchInterface) TestConfig(cfg *model.Config) *model.AppError {
|
||||
ret := _m.Called(cfg)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.Config) *model.AppError); ok {
|
||||
r0 = rf(cfg)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
289
einterfaces/mocks/LdapInterface.go
Normal file
289
einterfaces/mocks/LdapInterface.go
Normal file
@@ -0,0 +1,289 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// DoLogin provides a mock function with given fields: id, password
|
||||
func (_m *LdapInterface) DoLogin(id string, password string) (*model.User, *model.AppError) {
|
||||
ret := _m.Called(id, password)
|
||||
|
||||
var r0 *model.User
|
||||
if rf, ok := ret.Get(0).(func(string, string) *model.User); ok {
|
||||
r0 = rf(id, password)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.User)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
|
||||
r1 = rf(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: userID, userAuthService, userAuthData
|
||||
func (_m *LdapInterface) FirstLoginSync(userID string, userAuthService string, userAuthData string) *model.AppError {
|
||||
ret := _m.Called(userID, userAuthService, userAuthData)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, string, string) *model.AppError); ok {
|
||||
r0 = rf(userID, userAuthService, userAuthData)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 int
|
||||
if rf, ok := ret.Get(1).(func(int, int, model.LdapGroupSearchOpts) int); ok {
|
||||
r1 = rf(page, perPage, opts)
|
||||
} else {
|
||||
r1 = ret.Get(1).(int)
|
||||
}
|
||||
|
||||
var r2 *model.AppError
|
||||
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
|
||||
if rf, ok := ret.Get(0).(func() []*model.User); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*model.User)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
}
|
||||
|
||||
// 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
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
}
|
||||
|
||||
// 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
|
||||
func (_m *LdapInterface) StartSynchronizeJob(waitForJobToFinish bool) (*model.Job, *model.AppError) {
|
||||
ret := _m.Called(waitForJobToFinish)
|
||||
|
||||
var r0 *model.Job
|
||||
if rf, ok := ret.Get(0).(func(bool) *model.Job); ok {
|
||||
r0 = rf(waitForJobToFinish)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.Job)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(bool) *model.AppError); ok {
|
||||
r1 = rf(waitForJobToFinish)
|
||||
} 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
|
||||
}
|
||||
45
einterfaces/mocks/LdapSyncInterface.go
Normal file
45
einterfaces/mocks/LdapSyncInterface.go
Normal file
@@ -0,0 +1,45 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// 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
|
||||
}
|
||||
56
einterfaces/mocks/MessageExportInterface.go
Normal file
56
einterfaces/mocks/MessageExportInterface.go
Normal file
@@ -0,0 +1,56 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import context "context"
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/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
|
||||
func (_m *MessageExportInterface) RunExport(format string, since int64) *model.AppError {
|
||||
ret := _m.Called(format, since)
|
||||
|
||||
var r0 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, int64) *model.AppError); ok {
|
||||
r0 = rf(format, since)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// 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
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
}
|
||||
45
einterfaces/mocks/MessageExportJobInterface.go
Normal file
45
einterfaces/mocks/MessageExportJobInterface.go
Normal file
@@ -0,0 +1,45 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// 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
|
||||
}
|
||||
162
einterfaces/mocks/MetricsInterface.go
Normal file
162
einterfaces/mocks/MetricsInterface.go
Normal file
@@ -0,0 +1,162 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// IncrementClusterEventType provides a mock function with given fields: eventType
|
||||
func (_m *MetricsInterface) IncrementClusterEventType(eventType string) {
|
||||
_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)
|
||||
}
|
||||
|
||||
// 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()
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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()
|
||||
}
|
||||
|
||||
// IncrementWebSocketBroadcast provides a mock function with given fields: eventType
|
||||
func (_m *MetricsInterface) IncrementWebSocketBroadcast(eventType string) {
|
||||
_m.Called(eventType)
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
|
||||
// ObserveClusterRequestDuration provides a mock function with given fields: elapsed
|
||||
func (_m *MetricsInterface) ObserveClusterRequestDuration(elapsed float64) {
|
||||
_m.Called(elapsed)
|
||||
}
|
||||
|
||||
// ObserveHttpRequestDuration provides a mock function with given fields: elapsed
|
||||
func (_m *MetricsInterface) ObserveHttpRequestDuration(elapsed float64) {
|
||||
_m.Called(elapsed)
|
||||
}
|
||||
|
||||
// ObservePostsSearchDuration provides a mock function with given fields: elapsed
|
||||
func (_m *MetricsInterface) ObservePostsSearchDuration(elapsed float64) {
|
||||
_m.Called(elapsed)
|
||||
}
|
||||
|
||||
// StartServer provides a mock function with given fields:
|
||||
func (_m *MetricsInterface) StartServer() {
|
||||
_m.Called()
|
||||
}
|
||||
|
||||
// StopServer provides a mock function with given fields:
|
||||
func (_m *MetricsInterface) StopServer() {
|
||||
_m.Called()
|
||||
}
|
||||
100
einterfaces/mocks/MfaInterface.go
Normal file
100
einterfaces/mocks/MfaInterface.go
Normal file
@@ -0,0 +1,100 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// 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
|
||||
if rf, ok := ret.Get(0).(func(*model.User) string); ok {
|
||||
r0 = rf(user)
|
||||
} else {
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
var r1 []byte
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
var r2 *model.AppError
|
||||
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
|
||||
if rf, ok := ret.Get(0).(func(string, string) bool); ok {
|
||||
r0 = rf(secret, token)
|
||||
} else {
|
||||
r0 = ret.Get(0).(bool)
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
}
|
||||
30
einterfaces/mocks/OauthProvider.go
Normal file
30
einterfaces/mocks/OauthProvider.go
Normal file
@@ -0,0 +1,30 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import io "io"
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// OauthProvider is an autogenerated mock type for the OauthProvider type
|
||||
type OauthProvider struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
// GetUserFromJson provides a mock function with given fields: data
|
||||
func (_m *OauthProvider) GetUserFromJson(data io.Reader) *model.User {
|
||||
ret := _m.Called(data)
|
||||
|
||||
var r0 *model.User
|
||||
if rf, ok := ret.Get(0).(func(io.Reader) *model.User); ok {
|
||||
r0 = rf(data)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.User)
|
||||
}
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
100
einterfaces/mocks/SamlInterface.go
Normal file
100
einterfaces/mocks/SamlInterface.go
Normal file
@@ -0,0 +1,100 @@
|
||||
// Code generated by mockery v1.0.0. DO NOT EDIT.
|
||||
|
||||
// Regenerate this file using `make einterfaces-mocks`.
|
||||
|
||||
package mocks
|
||||
|
||||
import mock "github.com/stretchr/testify/mock"
|
||||
import model "github.com/mattermost/mattermost-server/model"
|
||||
|
||||
// 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
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
}
|
||||
|
||||
// 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: encodedXML, relayState
|
||||
func (_m *SamlInterface) DoLogin(encodedXML string, relayState map[string]string) (*model.User, *model.AppError) {
|
||||
ret := _m.Called(encodedXML, relayState)
|
||||
|
||||
var r0 *model.User
|
||||
if rf, ok := ret.Get(0).(func(string, map[string]string) *model.User); ok {
|
||||
r0 = rf(encodedXML, relayState)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.User)
|
||||
}
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(1).(func(string, map[string]string) *model.AppError); ok {
|
||||
r1 = rf(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
|
||||
if rf, ok := ret.Get(0).(func() string); ok {
|
||||
r0 = rf()
|
||||
} else {
|
||||
r0 = ret.Get(0).(string)
|
||||
}
|
||||
|
||||
var r1 *model.AppError
|
||||
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
|
||||
}
|
||||
@@ -5,7 +5,7 @@ count=0
|
||||
for fileType in GoFiles; do
|
||||
for file in `go list -f $'{{range .GoFiles}}{{$.Dir}}/{{.}}\n{{end}}' "$@"`; do
|
||||
case $file in
|
||||
*/utils/lru.go|*/utils/imgutils/gif.go|*/store/storetest/mocks/*|*/services/*/mocks/*|*/app/plugin/jira/plugin_*|*/plugin/plugintest/*|*/app/plugin/zoom/plugin_*)
|
||||
*/utils/lru.go|*/utils/imgutils/gif.go|*/store/storetest/mocks/*|*/services/*/mocks/*|*/app/plugin/jira/plugin_*|*/plugin/plugintest/*|*/app/plugin/zoom/plugin_*|*/einterfaces/mocks/*)
|
||||
# Third-party, doesn't require a header.
|
||||
;;
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user