From 6f6005c617799e2f51071f43af718e5d4e77492b Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 26 Oct 2017 11:36:54 -0500 Subject: Store mocks (#7724) * store mocks * add example --- Makefile | 4 + jobs/server_test.go | 39 + scripts/license-check.sh | 2 +- store/storetest/mocks/AuditStore.go | 78 ++ store/storetest/mocks/ChannelStore.go | 787 +++++++++++++++++++++ store/storetest/mocks/ClusterDiscoveryStore.go | 110 +++ store/storetest/mocks/CommandStore.go | 158 +++++ store/storetest/mocks/CommandWebhookStore.go | 67 ++ store/storetest/mocks/ComplianceStore.go | 94 +++ store/storetest/mocks/EmojiStore.go | 94 +++ store/storetest/mocks/FileInfoStore.go | 147 ++++ store/storetest/mocks/JobStore.go | 206 ++++++ store/storetest/mocks/LayeredStoreDatabaseLayer.go | 560 +++++++++++++++ store/storetest/mocks/LayeredStoreSupplier.go | 151 ++++ store/storetest/mocks/LicenseStore.go | 46 ++ store/storetest/mocks/OAuthStore.go | 302 ++++++++ store/storetest/mocks/PostStore.go | 419 +++++++++++ store/storetest/mocks/PreferenceStore.go | 174 +++++ store/storetest/mocks/ReactionStore.go | 94 +++ store/storetest/mocks/SessionStore.go | 190 +++++ store/storetest/mocks/SqlStore.go | 679 ++++++++++++++++++ store/storetest/mocks/StatusStore.go | 158 +++++ store/storetest/mocks/Store.go | 422 +++++++++++ store/storetest/mocks/SystemStore.go | 94 +++ store/storetest/mocks/TeamStore.go | 478 +++++++++++++ store/storetest/mocks/TokenStore.go | 67 ++ store/storetest/mocks/UserAccessTokenStore.go | 142 ++++ store/storetest/mocks/UserStore.go | 749 ++++++++++++++++++++ store/storetest/mocks/WebhookStore.go | 339 +++++++++ store/storetest/store.go | 100 +++ 30 files changed, 6949 insertions(+), 1 deletion(-) create mode 100644 jobs/server_test.go create mode 100644 store/storetest/mocks/AuditStore.go create mode 100644 store/storetest/mocks/ChannelStore.go create mode 100644 store/storetest/mocks/ClusterDiscoveryStore.go create mode 100644 store/storetest/mocks/CommandStore.go create mode 100644 store/storetest/mocks/CommandWebhookStore.go create mode 100644 store/storetest/mocks/ComplianceStore.go create mode 100644 store/storetest/mocks/EmojiStore.go create mode 100644 store/storetest/mocks/FileInfoStore.go create mode 100644 store/storetest/mocks/JobStore.go create mode 100644 store/storetest/mocks/LayeredStoreDatabaseLayer.go create mode 100644 store/storetest/mocks/LayeredStoreSupplier.go create mode 100644 store/storetest/mocks/LicenseStore.go create mode 100644 store/storetest/mocks/OAuthStore.go create mode 100644 store/storetest/mocks/PostStore.go create mode 100644 store/storetest/mocks/PreferenceStore.go create mode 100644 store/storetest/mocks/ReactionStore.go create mode 100644 store/storetest/mocks/SessionStore.go create mode 100644 store/storetest/mocks/SqlStore.go create mode 100644 store/storetest/mocks/StatusStore.go create mode 100644 store/storetest/mocks/Store.go create mode 100644 store/storetest/mocks/SystemStore.go create mode 100644 store/storetest/mocks/TeamStore.go create mode 100644 store/storetest/mocks/TokenStore.go create mode 100644 store/storetest/mocks/UserAccessTokenStore.go create mode 100644 store/storetest/mocks/UserStore.go create mode 100644 store/storetest/mocks/WebhookStore.go create mode 100644 store/storetest/store.go diff --git a/Makefile b/Makefile index a32743ca6..0bd8c090e 100644 --- a/Makefile +++ b/Makefile @@ -271,6 +271,10 @@ gofmt: done @echo "gofmt success"; \ +store-mocks: + go get github.com/vektra/mockery/... + mockery -dir store -all -output store/storetest/mocks -note 'Regenerate this file using `make store-mocks`.' + check-licenses: ./scripts/license-check.sh $(TE_PACKAGES) $(EE_PACKAGES) diff --git a/jobs/server_test.go b/jobs/server_test.go new file mode 100644 index 000000000..3b5ef6f3d --- /dev/null +++ b/jobs/server_test.go @@ -0,0 +1,39 @@ +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +package jobs + +import ( + "testing" + + "github.com/mattermost/mattermost-server/model" + "github.com/mattermost/mattermost-server/store" + "github.com/mattermost/mattermost-server/store/storetest" + "github.com/mattermost/mattermost-server/utils" +) + +func TestJobServer_LoadLicense(t *testing.T) { + if utils.T == nil { + utils.TranslationsPreInit() + } + + mockStore := &storetest.Store{} + defer mockStore.AssertExpectations(t) + + server := &JobServer{ + Store: mockStore, + } + + mockStore.SystemStore.On("Get").Return(storetest.NewStoreChannel(store.StoreResult{ + Data: model.StringMap{ + model.SYSTEM_ACTIVE_LICENSE_ID: "thelicenseid00000000000000", + }, + })) + mockStore.LicenseStore.On("Get", "thelicenseid00000000000000").Return(storetest.NewStoreChannel(store.StoreResult{ + Data: &model.LicenseRecord{ + Id: "thelicenseid00000000000000", + }, + })) + + server.LoadLicense() +} diff --git a/scripts/license-check.sh b/scripts/license-check.sh index be3b62508..8966551a0 100755 --- a/scripts/license-check.sh +++ b/scripts/license-check.sh @@ -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/lru.go|*/store/storetest/mocks/*) # Third-party, doesn't require a header. ;; *) diff --git a/store/storetest/mocks/AuditStore.go b/store/storetest/mocks/AuditStore.go new file mode 100644 index 000000000..df84545bd --- /dev/null +++ b/store/storetest/mocks/AuditStore.go @@ -0,0 +1,78 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// AuditStore is an autogenerated mock type for the AuditStore type +type AuditStore struct { + mock.Mock +} + +// Get provides a mock function with given fields: user_id, offset, limit +func (_m *AuditStore) Get(user_id string, offset int, limit int) store.StoreChannel { + ret := _m.Called(user_id, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(user_id, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteBatch provides a mock function with given fields: endTime, limit +func (_m *AuditStore) PermanentDeleteBatch(endTime int64, limit int64) store.StoreChannel { + ret := _m.Called(endTime, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int64, int64) store.StoreChannel); ok { + r0 = rf(endTime, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteByUser provides a mock function with given fields: userId +func (_m *AuditStore) PermanentDeleteByUser(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: audit +func (_m *AuditStore) Save(audit *model.Audit) store.StoreChannel { + ret := _m.Called(audit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Audit) store.StoreChannel); ok { + r0 = rf(audit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/ChannelStore.go b/store/storetest/mocks/ChannelStore.go new file mode 100644 index 000000000..2ea5256d7 --- /dev/null +++ b/store/storetest/mocks/ChannelStore.go @@ -0,0 +1,787 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// ChannelStore is an autogenerated mock type for the ChannelStore type +type ChannelStore struct { + mock.Mock +} + +// AnalyticsDeletedTypeCount provides a mock function with given fields: teamId, channelType +func (_m *ChannelStore) AnalyticsDeletedTypeCount(teamId string, channelType string) store.StoreChannel { + ret := _m.Called(teamId, channelType) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(teamId, channelType) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// AnalyticsTypeCount provides a mock function with given fields: teamId, channelType +func (_m *ChannelStore) AnalyticsTypeCount(teamId string, channelType string) store.StoreChannel { + ret := _m.Called(teamId, channelType) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(teamId, channelType) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// CreateDirectChannel provides a mock function with given fields: userId, otherUserId +func (_m *ChannelStore) CreateDirectChannel(userId string, otherUserId string) store.StoreChannel { + ret := _m.Called(userId, otherUserId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(userId, otherUserId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Delete provides a mock function with given fields: channelId, time +func (_m *ChannelStore) Delete(channelId string, time int64) store.StoreChannel { + ret := _m.Called(channelId, time) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64) store.StoreChannel); ok { + r0 = rf(channelId, time) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// ExtraUpdateByUser provides a mock function with given fields: userId, time +func (_m *ChannelStore) ExtraUpdateByUser(userId string, time int64) store.StoreChannel { + ret := _m.Called(userId, time) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64) store.StoreChannel); ok { + r0 = rf(userId, time) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: id, allowFromCache +func (_m *ChannelStore) Get(id string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(id, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool) store.StoreChannel); ok { + r0 = rf(id, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAll provides a mock function with given fields: teamId +func (_m *ChannelStore) GetAll(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllChannelMembersForUser provides a mock function with given fields: userId, allowFromCache +func (_m *ChannelStore) GetAllChannelMembersForUser(userId string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(userId, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool) store.StoreChannel); ok { + r0 = rf(userId, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllChannelMembersNotifyPropsForChannel provides a mock function with given fields: channelId, allowFromCache +func (_m *ChannelStore) GetAllChannelMembersNotifyPropsForChannel(channelId string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(channelId, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool) store.StoreChannel); ok { + r0 = rf(channelId, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByName provides a mock function with given fields: team_id, name, allowFromCache +func (_m *ChannelStore) GetByName(team_id string, name string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(team_id, name, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, bool) store.StoreChannel); ok { + r0 = rf(team_id, name, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByNameIncludeDeleted provides a mock function with given fields: team_id, name, allowFromCache +func (_m *ChannelStore) GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(team_id, name, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, bool) store.StoreChannel); ok { + r0 = rf(team_id, name, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetChannelCounts provides a mock function with given fields: teamId, userId +func (_m *ChannelStore) GetChannelCounts(teamId string, userId string) store.StoreChannel { + ret := _m.Called(teamId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(teamId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetChannelUnread provides a mock function with given fields: channelId, userId +func (_m *ChannelStore) GetChannelUnread(channelId string, userId string) store.StoreChannel { + ret := _m.Called(channelId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(channelId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetChannels provides a mock function with given fields: teamId, userId +func (_m *ChannelStore) GetChannels(teamId string, userId string) store.StoreChannel { + ret := _m.Called(teamId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(teamId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetDeleted provides a mock function with given fields: team_id, offset, limit +func (_m *ChannelStore) GetDeleted(team_id string, offset int, limit int) store.StoreChannel { + ret := _m.Called(team_id, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(team_id, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetDeletedByName provides a mock function with given fields: team_id, name +func (_m *ChannelStore) GetDeletedByName(team_id string, name string) store.StoreChannel { + ret := _m.Called(team_id, name) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(team_id, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetForPost provides a mock function with given fields: postId +func (_m *ChannelStore) GetForPost(postId string) store.StoreChannel { + ret := _m.Called(postId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(postId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetFromMaster provides a mock function with given fields: id +func (_m *ChannelStore) GetFromMaster(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetMember provides a mock function with given fields: channelId, userId +func (_m *ChannelStore) GetMember(channelId string, userId string) store.StoreChannel { + ret := _m.Called(channelId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(channelId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetMemberCount provides a mock function with given fields: channelId, allowFromCache +func (_m *ChannelStore) GetMemberCount(channelId string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(channelId, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool) store.StoreChannel); ok { + r0 = rf(channelId, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetMemberCountFromCache provides a mock function with given fields: channelId +func (_m *ChannelStore) GetMemberCountFromCache(channelId string) int64 { + ret := _m.Called(channelId) + + var r0 int64 + if rf, ok := ret.Get(0).(func(string) int64); ok { + r0 = rf(channelId) + } else { + r0 = ret.Get(0).(int64) + } + + return r0 +} + +// GetMemberForPost provides a mock function with given fields: postId, userId +func (_m *ChannelStore) GetMemberForPost(postId string, userId string) store.StoreChannel { + ret := _m.Called(postId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(postId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetMembers provides a mock function with given fields: channelId, offset, limit +func (_m *ChannelStore) GetMembers(channelId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(channelId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(channelId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetMembersByIds provides a mock function with given fields: channelId, userIds +func (_m *ChannelStore) GetMembersByIds(channelId string, userIds []string) store.StoreChannel { + ret := _m.Called(channelId, userIds) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, []string) store.StoreChannel); ok { + r0 = rf(channelId, userIds) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetMembersForUser provides a mock function with given fields: teamId, userId +func (_m *ChannelStore) GetMembersForUser(teamId string, userId string) store.StoreChannel { + ret := _m.Called(teamId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(teamId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetMoreChannels provides a mock function with given fields: teamId, userId, offset, limit +func (_m *ChannelStore) GetMoreChannels(teamId string, userId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(teamId, userId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, int, int) store.StoreChannel); ok { + r0 = rf(teamId, userId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetPinnedPosts provides a mock function with given fields: channelId +func (_m *ChannelStore) GetPinnedPosts(channelId string) store.StoreChannel { + ret := _m.Called(channelId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(channelId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetPublicChannelsByIdsForTeam provides a mock function with given fields: teamId, channelIds +func (_m *ChannelStore) GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) store.StoreChannel { + ret := _m.Called(teamId, channelIds) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, []string) store.StoreChannel); ok { + r0 = rf(teamId, channelIds) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetPublicChannelsForTeam provides a mock function with given fields: teamId, offset, limit +func (_m *ChannelStore) GetPublicChannelsForTeam(teamId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(teamId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(teamId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetTeamChannels provides a mock function with given fields: teamId +func (_m *ChannelStore) GetTeamChannels(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// IncrementMentionCount provides a mock function with given fields: channelId, userId +func (_m *ChannelStore) IncrementMentionCount(channelId string, userId string) store.StoreChannel { + ret := _m.Called(channelId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(channelId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// InvalidateAllChannelMembersForUser provides a mock function with given fields: userId +func (_m *ChannelStore) InvalidateAllChannelMembersForUser(userId string) { + _m.Called(userId) +} + +// InvalidateCacheForChannelMembersNotifyProps provides a mock function with given fields: channelId +func (_m *ChannelStore) InvalidateCacheForChannelMembersNotifyProps(channelId string) { + _m.Called(channelId) +} + +// InvalidateChannel provides a mock function with given fields: id +func (_m *ChannelStore) InvalidateChannel(id string) { + _m.Called(id) +} + +// InvalidateChannelByName provides a mock function with given fields: teamId, name +func (_m *ChannelStore) InvalidateChannelByName(teamId string, name string) { + _m.Called(teamId, name) +} + +// InvalidateMemberCount provides a mock function with given fields: channelId +func (_m *ChannelStore) InvalidateMemberCount(channelId string) { + _m.Called(channelId) +} + +// IsUserInChannelUseCache provides a mock function with given fields: userId, channelId +func (_m *ChannelStore) IsUserInChannelUseCache(userId string, channelId string) bool { + ret := _m.Called(userId, channelId) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string) bool); ok { + r0 = rf(userId, channelId) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// PermanentDelete provides a mock function with given fields: channelId +func (_m *ChannelStore) PermanentDelete(channelId string) store.StoreChannel { + ret := _m.Called(channelId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(channelId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteByTeam provides a mock function with given fields: teamId +func (_m *ChannelStore) PermanentDeleteByTeam(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteMembersByChannel provides a mock function with given fields: channelId +func (_m *ChannelStore) PermanentDeleteMembersByChannel(channelId string) store.StoreChannel { + ret := _m.Called(channelId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(channelId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteMembersByUser provides a mock function with given fields: userId +func (_m *ChannelStore) PermanentDeleteMembersByUser(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// RemoveMember provides a mock function with given fields: channelId, userId +func (_m *ChannelStore) RemoveMember(channelId string, userId string) store.StoreChannel { + ret := _m.Called(channelId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(channelId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Restore provides a mock function with given fields: channelId, time +func (_m *ChannelStore) Restore(channelId string, time int64) store.StoreChannel { + ret := _m.Called(channelId, time) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64) store.StoreChannel); ok { + r0 = rf(channelId, time) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: channel, maxChannelsPerTeam +func (_m *ChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) store.StoreChannel { + ret := _m.Called(channel, maxChannelsPerTeam) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Channel, int64) store.StoreChannel); ok { + r0 = rf(channel, maxChannelsPerTeam) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SaveDirectChannel provides a mock function with given fields: channel, member1, member2 +func (_m *ChannelStore) SaveDirectChannel(channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) store.StoreChannel { + ret := _m.Called(channel, member1, member2) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Channel, *model.ChannelMember, *model.ChannelMember) store.StoreChannel); ok { + r0 = rf(channel, member1, member2) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SaveMember provides a mock function with given fields: member +func (_m *ChannelStore) SaveMember(member *model.ChannelMember) store.StoreChannel { + ret := _m.Called(member) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.ChannelMember) store.StoreChannel); ok { + r0 = rf(member) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SearchInTeam provides a mock function with given fields: teamId, term +func (_m *ChannelStore) SearchInTeam(teamId string, term string) store.StoreChannel { + ret := _m.Called(teamId, term) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(teamId, term) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SearchMore provides a mock function with given fields: userId, teamId, term +func (_m *ChannelStore) SearchMore(userId string, teamId string, term string) store.StoreChannel { + ret := _m.Called(userId, teamId, term) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, string) store.StoreChannel); ok { + r0 = rf(userId, teamId, term) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SetDeleteAt provides a mock function with given fields: channelId, deleteAt, updateAt +func (_m *ChannelStore) SetDeleteAt(channelId string, deleteAt int64, updateAt int64) store.StoreChannel { + ret := _m.Called(channelId, deleteAt, updateAt) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64, int64) store.StoreChannel); ok { + r0 = rf(channelId, deleteAt, updateAt) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Update provides a mock function with given fields: channel +func (_m *ChannelStore) Update(channel *model.Channel) store.StoreChannel { + ret := _m.Called(channel) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Channel) store.StoreChannel); ok { + r0 = rf(channel) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateLastViewedAt provides a mock function with given fields: channelIds, userId +func (_m *ChannelStore) UpdateLastViewedAt(channelIds []string, userId string) store.StoreChannel { + ret := _m.Called(channelIds, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func([]string, string) store.StoreChannel); ok { + r0 = rf(channelIds, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateMember provides a mock function with given fields: member +func (_m *ChannelStore) UpdateMember(member *model.ChannelMember) store.StoreChannel { + ret := _m.Called(member) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.ChannelMember) store.StoreChannel); ok { + r0 = rf(member) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/ClusterDiscoveryStore.go b/store/storetest/mocks/ClusterDiscoveryStore.go new file mode 100644 index 000000000..997dcf03f --- /dev/null +++ b/store/storetest/mocks/ClusterDiscoveryStore.go @@ -0,0 +1,110 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// ClusterDiscoveryStore is an autogenerated mock type for the ClusterDiscoveryStore type +type ClusterDiscoveryStore struct { + mock.Mock +} + +// Cleanup provides a mock function with given fields: +func (_m *ClusterDiscoveryStore) Cleanup() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Delete provides a mock function with given fields: discovery +func (_m *ClusterDiscoveryStore) Delete(discovery *model.ClusterDiscovery) store.StoreChannel { + ret := _m.Called(discovery) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.ClusterDiscovery) store.StoreChannel); ok { + r0 = rf(discovery) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Exists provides a mock function with given fields: discovery +func (_m *ClusterDiscoveryStore) Exists(discovery *model.ClusterDiscovery) store.StoreChannel { + ret := _m.Called(discovery) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.ClusterDiscovery) store.StoreChannel); ok { + r0 = rf(discovery) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAll provides a mock function with given fields: discoveryType, clusterName +func (_m *ClusterDiscoveryStore) GetAll(discoveryType string, clusterName string) store.StoreChannel { + ret := _m.Called(discoveryType, clusterName) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(discoveryType, clusterName) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: discovery +func (_m *ClusterDiscoveryStore) Save(discovery *model.ClusterDiscovery) store.StoreChannel { + ret := _m.Called(discovery) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.ClusterDiscovery) store.StoreChannel); ok { + r0 = rf(discovery) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SetLastPingAt provides a mock function with given fields: discovery +func (_m *ClusterDiscoveryStore) SetLastPingAt(discovery *model.ClusterDiscovery) store.StoreChannel { + ret := _m.Called(discovery) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.ClusterDiscovery) store.StoreChannel); ok { + r0 = rf(discovery) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/CommandStore.go b/store/storetest/mocks/CommandStore.go new file mode 100644 index 000000000..de4bc4e34 --- /dev/null +++ b/store/storetest/mocks/CommandStore.go @@ -0,0 +1,158 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// CommandStore is an autogenerated mock type for the CommandStore type +type CommandStore struct { + mock.Mock +} + +// AnalyticsCommandCount provides a mock function with given fields: teamId +func (_m *CommandStore) AnalyticsCommandCount(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Delete provides a mock function with given fields: commandId, time +func (_m *CommandStore) Delete(commandId string, time int64) store.StoreChannel { + ret := _m.Called(commandId, time) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64) store.StoreChannel); ok { + r0 = rf(commandId, time) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: id +func (_m *CommandStore) Get(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByTeam provides a mock function with given fields: teamId +func (_m *CommandStore) GetByTeam(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByTrigger provides a mock function with given fields: teamId, trigger +func (_m *CommandStore) GetByTrigger(teamId string, trigger string) store.StoreChannel { + ret := _m.Called(teamId, trigger) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(teamId, trigger) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteByTeam provides a mock function with given fields: teamId +func (_m *CommandStore) PermanentDeleteByTeam(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteByUser provides a mock function with given fields: userId +func (_m *CommandStore) PermanentDeleteByUser(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: webhook +func (_m *CommandStore) Save(webhook *model.Command) store.StoreChannel { + ret := _m.Called(webhook) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Command) store.StoreChannel); ok { + r0 = rf(webhook) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Update provides a mock function with given fields: hook +func (_m *CommandStore) Update(hook *model.Command) store.StoreChannel { + ret := _m.Called(hook) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Command) store.StoreChannel); ok { + r0 = rf(hook) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/CommandWebhookStore.go b/store/storetest/mocks/CommandWebhookStore.go new file mode 100644 index 000000000..cede8cdd2 --- /dev/null +++ b/store/storetest/mocks/CommandWebhookStore.go @@ -0,0 +1,67 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// CommandWebhookStore is an autogenerated mock type for the CommandWebhookStore type +type CommandWebhookStore struct { + mock.Mock +} + +// Cleanup provides a mock function with given fields: +func (_m *CommandWebhookStore) Cleanup() { + _m.Called() +} + +// Get provides a mock function with given fields: id +func (_m *CommandWebhookStore) Get(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: webhook +func (_m *CommandWebhookStore) Save(webhook *model.CommandWebhook) store.StoreChannel { + ret := _m.Called(webhook) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.CommandWebhook) store.StoreChannel); ok { + r0 = rf(webhook) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// TryUse provides a mock function with given fields: id, limit +func (_m *CommandWebhookStore) TryUse(id string, limit int) store.StoreChannel { + ret := _m.Called(id, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int) store.StoreChannel); ok { + r0 = rf(id, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/ComplianceStore.go b/store/storetest/mocks/ComplianceStore.go new file mode 100644 index 000000000..b2208ead7 --- /dev/null +++ b/store/storetest/mocks/ComplianceStore.go @@ -0,0 +1,94 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// ComplianceStore is an autogenerated mock type for the ComplianceStore type +type ComplianceStore struct { + mock.Mock +} + +// ComplianceExport provides a mock function with given fields: compliance +func (_m *ComplianceStore) ComplianceExport(compliance *model.Compliance) store.StoreChannel { + ret := _m.Called(compliance) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Compliance) store.StoreChannel); ok { + r0 = rf(compliance) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: id +func (_m *ComplianceStore) Get(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAll provides a mock function with given fields: offset, limit +func (_m *ComplianceStore) GetAll(offset int, limit int) store.StoreChannel { + ret := _m.Called(offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int, int) store.StoreChannel); ok { + r0 = rf(offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: compliance +func (_m *ComplianceStore) Save(compliance *model.Compliance) store.StoreChannel { + ret := _m.Called(compliance) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Compliance) store.StoreChannel); ok { + r0 = rf(compliance) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Update provides a mock function with given fields: compliance +func (_m *ComplianceStore) Update(compliance *model.Compliance) store.StoreChannel { + ret := _m.Called(compliance) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Compliance) store.StoreChannel); ok { + r0 = rf(compliance) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/EmojiStore.go b/store/storetest/mocks/EmojiStore.go new file mode 100644 index 000000000..c01e64578 --- /dev/null +++ b/store/storetest/mocks/EmojiStore.go @@ -0,0 +1,94 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// EmojiStore is an autogenerated mock type for the EmojiStore type +type EmojiStore struct { + mock.Mock +} + +// Delete provides a mock function with given fields: id, time +func (_m *EmojiStore) Delete(id string, time int64) store.StoreChannel { + ret := _m.Called(id, time) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64) store.StoreChannel); ok { + r0 = rf(id, time) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: id, allowFromCache +func (_m *EmojiStore) Get(id string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(id, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool) store.StoreChannel); ok { + r0 = rf(id, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByName provides a mock function with given fields: name +func (_m *EmojiStore) GetByName(name string) store.StoreChannel { + ret := _m.Called(name) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetList provides a mock function with given fields: offset, limit +func (_m *EmojiStore) GetList(offset int, limit int) store.StoreChannel { + ret := _m.Called(offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int, int) store.StoreChannel); ok { + r0 = rf(offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: emoji +func (_m *EmojiStore) Save(emoji *model.Emoji) store.StoreChannel { + ret := _m.Called(emoji) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Emoji) store.StoreChannel); ok { + r0 = rf(emoji) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/FileInfoStore.go b/store/storetest/mocks/FileInfoStore.go new file mode 100644 index 000000000..9b479ff3a --- /dev/null +++ b/store/storetest/mocks/FileInfoStore.go @@ -0,0 +1,147 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// FileInfoStore is an autogenerated mock type for the FileInfoStore type +type FileInfoStore struct { + mock.Mock +} + +// AttachToPost provides a mock function with given fields: fileId, postId +func (_m *FileInfoStore) AttachToPost(fileId string, postId string) store.StoreChannel { + ret := _m.Called(fileId, postId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(fileId, postId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// DeleteForPost provides a mock function with given fields: postId +func (_m *FileInfoStore) DeleteForPost(postId string) store.StoreChannel { + ret := _m.Called(postId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(postId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: id +func (_m *FileInfoStore) Get(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByPath provides a mock function with given fields: path +func (_m *FileInfoStore) GetByPath(path string) store.StoreChannel { + ret := _m.Called(path) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(path) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetForPost provides a mock function with given fields: postId, readFromMaster, allowFromCache +func (_m *FileInfoStore) GetForPost(postId string, readFromMaster bool, allowFromCache bool) store.StoreChannel { + ret := _m.Called(postId, readFromMaster, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool, bool) store.StoreChannel); ok { + r0 = rf(postId, readFromMaster, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// InvalidateFileInfosForPostCache provides a mock function with given fields: postId +func (_m *FileInfoStore) InvalidateFileInfosForPostCache(postId string) { + _m.Called(postId) +} + +// PermanentDelete provides a mock function with given fields: fileId +func (_m *FileInfoStore) PermanentDelete(fileId string) store.StoreChannel { + ret := _m.Called(fileId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(fileId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteBatch provides a mock function with given fields: endTime, limit +func (_m *FileInfoStore) PermanentDeleteBatch(endTime int64, limit int64) store.StoreChannel { + ret := _m.Called(endTime, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int64, int64) store.StoreChannel); ok { + r0 = rf(endTime, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: info +func (_m *FileInfoStore) Save(info *model.FileInfo) store.StoreChannel { + ret := _m.Called(info) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.FileInfo) store.StoreChannel); ok { + r0 = rf(info) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/JobStore.go b/store/storetest/mocks/JobStore.go new file mode 100644 index 000000000..d3558212e --- /dev/null +++ b/store/storetest/mocks/JobStore.go @@ -0,0 +1,206 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// JobStore is an autogenerated mock type for the JobStore type +type JobStore struct { + mock.Mock +} + +// Delete provides a mock function with given fields: id +func (_m *JobStore) Delete(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: id +func (_m *JobStore) Get(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllByStatus provides a mock function with given fields: status +func (_m *JobStore) GetAllByStatus(status string) store.StoreChannel { + ret := _m.Called(status) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(status) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllByType provides a mock function with given fields: jobType +func (_m *JobStore) GetAllByType(jobType string) store.StoreChannel { + ret := _m.Called(jobType) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(jobType) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllByTypePage provides a mock function with given fields: jobType, offset, limit +func (_m *JobStore) GetAllByTypePage(jobType string, offset int, limit int) store.StoreChannel { + ret := _m.Called(jobType, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(jobType, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllPage provides a mock function with given fields: offset, limit +func (_m *JobStore) GetAllPage(offset int, limit int) store.StoreChannel { + ret := _m.Called(offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int, int) store.StoreChannel); ok { + r0 = rf(offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetCountByStatusAndType provides a mock function with given fields: status, jobType +func (_m *JobStore) GetCountByStatusAndType(status string, jobType string) store.StoreChannel { + ret := _m.Called(status, jobType) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(status, jobType) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetNewestJobByStatusAndType provides a mock function with given fields: status, jobType +func (_m *JobStore) GetNewestJobByStatusAndType(status string, jobType string) store.StoreChannel { + ret := _m.Called(status, jobType) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(status, jobType) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: job +func (_m *JobStore) Save(job *model.Job) store.StoreChannel { + ret := _m.Called(job) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Job) store.StoreChannel); ok { + r0 = rf(job) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateOptimistically provides a mock function with given fields: job, currentStatus +func (_m *JobStore) UpdateOptimistically(job *model.Job, currentStatus string) store.StoreChannel { + ret := _m.Called(job, currentStatus) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Job, string) store.StoreChannel); ok { + r0 = rf(job, currentStatus) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateStatus provides a mock function with given fields: id, status +func (_m *JobStore) UpdateStatus(id string, status string) store.StoreChannel { + ret := _m.Called(id, status) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(id, status) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateStatusOptimistically provides a mock function with given fields: id, currentStatus, newStatus +func (_m *JobStore) UpdateStatusOptimistically(id string, currentStatus string, newStatus string) store.StoreChannel { + ret := _m.Called(id, currentStatus, newStatus) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, string) store.StoreChannel); ok { + r0 = rf(id, currentStatus, newStatus) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/LayeredStoreDatabaseLayer.go b/store/storetest/mocks/LayeredStoreDatabaseLayer.go new file mode 100644 index 000000000..1eb09c343 --- /dev/null +++ b/store/storetest/mocks/LayeredStoreDatabaseLayer.go @@ -0,0 +1,560 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import context "context" +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// LayeredStoreDatabaseLayer is an autogenerated mock type for the LayeredStoreDatabaseLayer type +type LayeredStoreDatabaseLayer struct { + mock.Mock +} + +// Audit provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Audit() store.AuditStore { + ret := _m.Called() + + var r0 store.AuditStore + if rf, ok := ret.Get(0).(func() store.AuditStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.AuditStore) + } + } + + return r0 +} + +// Channel provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Channel() store.ChannelStore { + ret := _m.Called() + + var r0 store.ChannelStore + if rf, ok := ret.Get(0).(func() store.ChannelStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ChannelStore) + } + } + + return r0 +} + +// Close provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Close() { + _m.Called() +} + +// ClusterDiscovery provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) ClusterDiscovery() store.ClusterDiscoveryStore { + ret := _m.Called() + + var r0 store.ClusterDiscoveryStore + if rf, ok := ret.Get(0).(func() store.ClusterDiscoveryStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ClusterDiscoveryStore) + } + } + + return r0 +} + +// Command provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Command() store.CommandStore { + ret := _m.Called() + + var r0 store.CommandStore + if rf, ok := ret.Get(0).(func() store.CommandStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.CommandStore) + } + } + + return r0 +} + +// CommandWebhook provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) CommandWebhook() store.CommandWebhookStore { + ret := _m.Called() + + var r0 store.CommandWebhookStore + if rf, ok := ret.Get(0).(func() store.CommandWebhookStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.CommandWebhookStore) + } + } + + return r0 +} + +// Compliance provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Compliance() store.ComplianceStore { + ret := _m.Called() + + var r0 store.ComplianceStore + if rf, ok := ret.Get(0).(func() store.ComplianceStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ComplianceStore) + } + } + + return r0 +} + +// DropAllTables provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) DropAllTables() { + _m.Called() +} + +// Emoji provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Emoji() store.EmojiStore { + ret := _m.Called() + + var r0 store.EmojiStore + if rf, ok := ret.Get(0).(func() store.EmojiStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.EmojiStore) + } + } + + return r0 +} + +// FileInfo provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) FileInfo() store.FileInfoStore { + ret := _m.Called() + + var r0 store.FileInfoStore + if rf, ok := ret.Get(0).(func() store.FileInfoStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.FileInfoStore) + } + } + + return r0 +} + +// Job provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Job() store.JobStore { + ret := _m.Called() + + var r0 store.JobStore + if rf, ok := ret.Get(0).(func() store.JobStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.JobStore) + } + } + + return r0 +} + +// License provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) License() store.LicenseStore { + ret := _m.Called() + + var r0 store.LicenseStore + if rf, ok := ret.Get(0).(func() store.LicenseStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.LicenseStore) + } + } + + return r0 +} + +// MarkSystemRanUnitTests provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) MarkSystemRanUnitTests() { + _m.Called() +} + +// Next provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Next() store.LayeredStoreSupplier { + ret := _m.Called() + + var r0 store.LayeredStoreSupplier + if rf, ok := ret.Get(0).(func() store.LayeredStoreSupplier); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.LayeredStoreSupplier) + } + } + + return r0 +} + +// OAuth provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) OAuth() store.OAuthStore { + ret := _m.Called() + + var r0 store.OAuthStore + if rf, ok := ret.Get(0).(func() store.OAuthStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.OAuthStore) + } + } + + return r0 +} + +// Post provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Post() store.PostStore { + ret := _m.Called() + + var r0 store.PostStore + if rf, ok := ret.Get(0).(func() store.PostStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.PostStore) + } + } + + return r0 +} + +// Preference provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Preference() store.PreferenceStore { + ret := _m.Called() + + var r0 store.PreferenceStore + if rf, ok := ret.Get(0).(func() store.PreferenceStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.PreferenceStore) + } + } + + return r0 +} + +// Reaction provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Reaction() store.ReactionStore { + ret := _m.Called() + + var r0 store.ReactionStore + if rf, ok := ret.Get(0).(func() store.ReactionStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ReactionStore) + } + } + + return r0 +} + +// ReactionDelete provides a mock function with given fields: ctx, reaction, hints +func (_m *LayeredStoreDatabaseLayer) ReactionDelete(ctx context.Context, reaction *model.Reaction, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult { + _va := make([]interface{}, len(hints)) + for _i := range hints { + _va[_i] = hints[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, reaction) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *store.LayeredStoreSupplierResult + if rf, ok := ret.Get(0).(func(context.Context, *model.Reaction, ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult); ok { + r0 = rf(ctx, reaction, hints...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*store.LayeredStoreSupplierResult) + } + } + + return r0 +} + +// ReactionDeleteAllWithEmojiName provides a mock function with given fields: ctx, emojiName, hints +func (_m *LayeredStoreDatabaseLayer) ReactionDeleteAllWithEmojiName(ctx context.Context, emojiName string, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult { + _va := make([]interface{}, len(hints)) + for _i := range hints { + _va[_i] = hints[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, emojiName) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *store.LayeredStoreSupplierResult + if rf, ok := ret.Get(0).(func(context.Context, string, ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult); ok { + r0 = rf(ctx, emojiName, hints...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*store.LayeredStoreSupplierResult) + } + } + + return r0 +} + +// ReactionGetForPost provides a mock function with given fields: ctx, postId, hints +func (_m *LayeredStoreDatabaseLayer) ReactionGetForPost(ctx context.Context, postId string, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult { + _va := make([]interface{}, len(hints)) + for _i := range hints { + _va[_i] = hints[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, postId) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *store.LayeredStoreSupplierResult + if rf, ok := ret.Get(0).(func(context.Context, string, ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult); ok { + r0 = rf(ctx, postId, hints...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*store.LayeredStoreSupplierResult) + } + } + + return r0 +} + +// ReactionPermanentDeleteBatch provides a mock function with given fields: ctx, endTime, limit, hints +func (_m *LayeredStoreDatabaseLayer) ReactionPermanentDeleteBatch(ctx context.Context, endTime int64, limit int64, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult { + _va := make([]interface{}, len(hints)) + for _i := range hints { + _va[_i] = hints[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, endTime, limit) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *store.LayeredStoreSupplierResult + if rf, ok := ret.Get(0).(func(context.Context, int64, int64, ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult); ok { + r0 = rf(ctx, endTime, limit, hints...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*store.LayeredStoreSupplierResult) + } + } + + return r0 +} + +// ReactionSave provides a mock function with given fields: ctx, reaction, hints +func (_m *LayeredStoreDatabaseLayer) ReactionSave(ctx context.Context, reaction *model.Reaction, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult { + _va := make([]interface{}, len(hints)) + for _i := range hints { + _va[_i] = hints[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, reaction) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *store.LayeredStoreSupplierResult + if rf, ok := ret.Get(0).(func(context.Context, *model.Reaction, ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult); ok { + r0 = rf(ctx, reaction, hints...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*store.LayeredStoreSupplierResult) + } + } + + return r0 +} + +// Session provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Session() store.SessionStore { + ret := _m.Called() + + var r0 store.SessionStore + if rf, ok := ret.Get(0).(func() store.SessionStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.SessionStore) + } + } + + return r0 +} + +// SetChainNext provides a mock function with given fields: _a0 +func (_m *LayeredStoreDatabaseLayer) SetChainNext(_a0 store.LayeredStoreSupplier) { + _m.Called(_a0) +} + +// Status provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Status() store.StatusStore { + ret := _m.Called() + + var r0 store.StatusStore + if rf, ok := ret.Get(0).(func() store.StatusStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StatusStore) + } + } + + return r0 +} + +// System provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) System() store.SystemStore { + ret := _m.Called() + + var r0 store.SystemStore + if rf, ok := ret.Get(0).(func() store.SystemStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.SystemStore) + } + } + + return r0 +} + +// Team provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Team() store.TeamStore { + ret := _m.Called() + + var r0 store.TeamStore + if rf, ok := ret.Get(0).(func() store.TeamStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.TeamStore) + } + } + + return r0 +} + +// Token provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Token() store.TokenStore { + ret := _m.Called() + + var r0 store.TokenStore + if rf, ok := ret.Get(0).(func() store.TokenStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.TokenStore) + } + } + + return r0 +} + +// TotalMasterDbConnections provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) TotalMasterDbConnections() 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 +} + +// TotalReadDbConnections provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) TotalReadDbConnections() 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 +} + +// TotalSearchDbConnections provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) TotalSearchDbConnections() 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 +} + +// User provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) User() store.UserStore { + ret := _m.Called() + + var r0 store.UserStore + if rf, ok := ret.Get(0).(func() store.UserStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.UserStore) + } + } + + return r0 +} + +// UserAccessToken provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) UserAccessToken() store.UserAccessTokenStore { + ret := _m.Called() + + var r0 store.UserAccessTokenStore + if rf, ok := ret.Get(0).(func() store.UserAccessTokenStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.UserAccessTokenStore) + } + } + + return r0 +} + +// Webhook provides a mock function with given fields: +func (_m *LayeredStoreDatabaseLayer) Webhook() store.WebhookStore { + ret := _m.Called() + + var r0 store.WebhookStore + if rf, ok := ret.Get(0).(func() store.WebhookStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.WebhookStore) + } + } + + return r0 +} diff --git a/store/storetest/mocks/LayeredStoreSupplier.go b/store/storetest/mocks/LayeredStoreSupplier.go new file mode 100644 index 000000000..f4187dae9 --- /dev/null +++ b/store/storetest/mocks/LayeredStoreSupplier.go @@ -0,0 +1,151 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import context "context" +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// LayeredStoreSupplier is an autogenerated mock type for the LayeredStoreSupplier type +type LayeredStoreSupplier struct { + mock.Mock +} + +// Next provides a mock function with given fields: +func (_m *LayeredStoreSupplier) Next() store.LayeredStoreSupplier { + ret := _m.Called() + + var r0 store.LayeredStoreSupplier + if rf, ok := ret.Get(0).(func() store.LayeredStoreSupplier); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.LayeredStoreSupplier) + } + } + + return r0 +} + +// ReactionDelete provides a mock function with given fields: ctx, reaction, hints +func (_m *LayeredStoreSupplier) ReactionDelete(ctx context.Context, reaction *model.Reaction, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult { + _va := make([]interface{}, len(hints)) + for _i := range hints { + _va[_i] = hints[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, reaction) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *store.LayeredStoreSupplierResult + if rf, ok := ret.Get(0).(func(context.Context, *model.Reaction, ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult); ok { + r0 = rf(ctx, reaction, hints...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*store.LayeredStoreSupplierResult) + } + } + + return r0 +} + +// ReactionDeleteAllWithEmojiName provides a mock function with given fields: ctx, emojiName, hints +func (_m *LayeredStoreSupplier) ReactionDeleteAllWithEmojiName(ctx context.Context, emojiName string, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult { + _va := make([]interface{}, len(hints)) + for _i := range hints { + _va[_i] = hints[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, emojiName) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *store.LayeredStoreSupplierResult + if rf, ok := ret.Get(0).(func(context.Context, string, ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult); ok { + r0 = rf(ctx, emojiName, hints...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*store.LayeredStoreSupplierResult) + } + } + + return r0 +} + +// ReactionGetForPost provides a mock function with given fields: ctx, postId, hints +func (_m *LayeredStoreSupplier) ReactionGetForPost(ctx context.Context, postId string, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult { + _va := make([]interface{}, len(hints)) + for _i := range hints { + _va[_i] = hints[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, postId) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *store.LayeredStoreSupplierResult + if rf, ok := ret.Get(0).(func(context.Context, string, ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult); ok { + r0 = rf(ctx, postId, hints...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*store.LayeredStoreSupplierResult) + } + } + + return r0 +} + +// ReactionPermanentDeleteBatch provides a mock function with given fields: ctx, endTime, limit, hints +func (_m *LayeredStoreSupplier) ReactionPermanentDeleteBatch(ctx context.Context, endTime int64, limit int64, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult { + _va := make([]interface{}, len(hints)) + for _i := range hints { + _va[_i] = hints[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, endTime, limit) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *store.LayeredStoreSupplierResult + if rf, ok := ret.Get(0).(func(context.Context, int64, int64, ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult); ok { + r0 = rf(ctx, endTime, limit, hints...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*store.LayeredStoreSupplierResult) + } + } + + return r0 +} + +// ReactionSave provides a mock function with given fields: ctx, reaction, hints +func (_m *LayeredStoreSupplier) ReactionSave(ctx context.Context, reaction *model.Reaction, hints ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult { + _va := make([]interface{}, len(hints)) + for _i := range hints { + _va[_i] = hints[_i] + } + var _ca []interface{} + _ca = append(_ca, ctx, reaction) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + var r0 *store.LayeredStoreSupplierResult + if rf, ok := ret.Get(0).(func(context.Context, *model.Reaction, ...store.LayeredStoreHint) *store.LayeredStoreSupplierResult); ok { + r0 = rf(ctx, reaction, hints...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*store.LayeredStoreSupplierResult) + } + } + + return r0 +} + +// SetChainNext provides a mock function with given fields: _a0 +func (_m *LayeredStoreSupplier) SetChainNext(_a0 store.LayeredStoreSupplier) { + _m.Called(_a0) +} diff --git a/store/storetest/mocks/LicenseStore.go b/store/storetest/mocks/LicenseStore.go new file mode 100644 index 000000000..5c65425ea --- /dev/null +++ b/store/storetest/mocks/LicenseStore.go @@ -0,0 +1,46 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// LicenseStore is an autogenerated mock type for the LicenseStore type +type LicenseStore struct { + mock.Mock +} + +// Get provides a mock function with given fields: id +func (_m *LicenseStore) Get(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: license +func (_m *LicenseStore) Save(license *model.LicenseRecord) store.StoreChannel { + ret := _m.Called(license) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.LicenseRecord) store.StoreChannel); ok { + r0 = rf(license) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/OAuthStore.go b/store/storetest/mocks/OAuthStore.go new file mode 100644 index 000000000..fb49d715d --- /dev/null +++ b/store/storetest/mocks/OAuthStore.go @@ -0,0 +1,302 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// OAuthStore is an autogenerated mock type for the OAuthStore type +type OAuthStore struct { + mock.Mock +} + +// DeleteApp provides a mock function with given fields: id +func (_m *OAuthStore) DeleteApp(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAccessData provides a mock function with given fields: token +func (_m *OAuthStore) GetAccessData(token string) store.StoreChannel { + ret := _m.Called(token) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(token) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAccessDataByRefreshToken provides a mock function with given fields: token +func (_m *OAuthStore) GetAccessDataByRefreshToken(token string) store.StoreChannel { + ret := _m.Called(token) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(token) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAccessDataByUserForApp provides a mock function with given fields: userId, clientId +func (_m *OAuthStore) GetAccessDataByUserForApp(userId string, clientId string) store.StoreChannel { + ret := _m.Called(userId, clientId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(userId, clientId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetApp provides a mock function with given fields: id +func (_m *OAuthStore) GetApp(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAppByUser provides a mock function with given fields: userId, offset, limit +func (_m *OAuthStore) GetAppByUser(userId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(userId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(userId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetApps provides a mock function with given fields: offset, limit +func (_m *OAuthStore) GetApps(offset int, limit int) store.StoreChannel { + ret := _m.Called(offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int, int) store.StoreChannel); ok { + r0 = rf(offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAuthData provides a mock function with given fields: code +func (_m *OAuthStore) GetAuthData(code string) store.StoreChannel { + ret := _m.Called(code) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(code) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAuthorizedApps provides a mock function with given fields: userId, offset, limit +func (_m *OAuthStore) GetAuthorizedApps(userId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(userId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(userId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetPreviousAccessData provides a mock function with given fields: userId, clientId +func (_m *OAuthStore) GetPreviousAccessData(userId string, clientId string) store.StoreChannel { + ret := _m.Called(userId, clientId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(userId, clientId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteAuthDataByUser provides a mock function with given fields: userId +func (_m *OAuthStore) PermanentDeleteAuthDataByUser(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// RemoveAccessData provides a mock function with given fields: token +func (_m *OAuthStore) RemoveAccessData(token string) store.StoreChannel { + ret := _m.Called(token) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(token) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// RemoveAuthData provides a mock function with given fields: code +func (_m *OAuthStore) RemoveAuthData(code string) store.StoreChannel { + ret := _m.Called(code) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(code) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SaveAccessData provides a mock function with given fields: accessData +func (_m *OAuthStore) SaveAccessData(accessData *model.AccessData) store.StoreChannel { + ret := _m.Called(accessData) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.AccessData) store.StoreChannel); ok { + r0 = rf(accessData) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SaveApp provides a mock function with given fields: app +func (_m *OAuthStore) SaveApp(app *model.OAuthApp) store.StoreChannel { + ret := _m.Called(app) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.OAuthApp) store.StoreChannel); ok { + r0 = rf(app) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SaveAuthData provides a mock function with given fields: authData +func (_m *OAuthStore) SaveAuthData(authData *model.AuthData) store.StoreChannel { + ret := _m.Called(authData) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.AuthData) store.StoreChannel); ok { + r0 = rf(authData) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateAccessData provides a mock function with given fields: accessData +func (_m *OAuthStore) UpdateAccessData(accessData *model.AccessData) store.StoreChannel { + ret := _m.Called(accessData) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.AccessData) store.StoreChannel); ok { + r0 = rf(accessData) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateApp provides a mock function with given fields: app +func (_m *OAuthStore) UpdateApp(app *model.OAuthApp) store.StoreChannel { + ret := _m.Called(app) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.OAuthApp) store.StoreChannel); ok { + r0 = rf(app) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/PostStore.go b/store/storetest/mocks/PostStore.go new file mode 100644 index 000000000..05e3bde34 --- /dev/null +++ b/store/storetest/mocks/PostStore.go @@ -0,0 +1,419 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// PostStore is an autogenerated mock type for the PostStore type +type PostStore struct { + mock.Mock +} + +// AnalyticsPostCount provides a mock function with given fields: teamId, mustHaveFile, mustHaveHashtag +func (_m *PostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) store.StoreChannel { + ret := _m.Called(teamId, mustHaveFile, mustHaveHashtag) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool, bool) store.StoreChannel); ok { + r0 = rf(teamId, mustHaveFile, mustHaveHashtag) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// AnalyticsPostCountsByDay provides a mock function with given fields: teamId +func (_m *PostStore) AnalyticsPostCountsByDay(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// AnalyticsUserCountsWithPostsByDay provides a mock function with given fields: teamId +func (_m *PostStore) AnalyticsUserCountsWithPostsByDay(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Delete provides a mock function with given fields: postId, time +func (_m *PostStore) Delete(postId string, time int64) store.StoreChannel { + ret := _m.Called(postId, time) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64) store.StoreChannel); ok { + r0 = rf(postId, time) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: id +func (_m *PostStore) Get(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetEtag provides a mock function with given fields: channelId, allowFromCache +func (_m *PostStore) GetEtag(channelId string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(channelId, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool) store.StoreChannel); ok { + r0 = rf(channelId, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetFlaggedPosts provides a mock function with given fields: userId, offset, limit +func (_m *PostStore) GetFlaggedPosts(userId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(userId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(userId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetFlaggedPostsForChannel provides a mock function with given fields: userId, channelId, offset, limit +func (_m *PostStore) GetFlaggedPostsForChannel(userId string, channelId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(userId, channelId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, int, int) store.StoreChannel); ok { + r0 = rf(userId, channelId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetFlaggedPostsForTeam provides a mock function with given fields: userId, teamId, offset, limit +func (_m *PostStore) GetFlaggedPostsForTeam(userId string, teamId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(userId, teamId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, int, int) store.StoreChannel); ok { + r0 = rf(userId, teamId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetOldest provides a mock function with given fields: +func (_m *PostStore) GetOldest() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetPosts provides a mock function with given fields: channelId, offset, limit, allowFromCache +func (_m *PostStore) GetPosts(channelId string, offset int, limit int, allowFromCache bool) store.StoreChannel { + ret := _m.Called(channelId, offset, limit, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int, bool) store.StoreChannel); ok { + r0 = rf(channelId, offset, limit, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetPostsAfter provides a mock function with given fields: channelId, postId, numPosts, offset +func (_m *PostStore) GetPostsAfter(channelId string, postId string, numPosts int, offset int) store.StoreChannel { + ret := _m.Called(channelId, postId, numPosts, offset) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, int, int) store.StoreChannel); ok { + r0 = rf(channelId, postId, numPosts, offset) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetPostsBatchForIndexing provides a mock function with given fields: startTime, endTime, limit +func (_m *PostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) store.StoreChannel { + ret := _m.Called(startTime, endTime, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int64, int64, int) store.StoreChannel); ok { + r0 = rf(startTime, endTime, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetPostsBefore provides a mock function with given fields: channelId, postId, numPosts, offset +func (_m *PostStore) GetPostsBefore(channelId string, postId string, numPosts int, offset int) store.StoreChannel { + ret := _m.Called(channelId, postId, numPosts, offset) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, int, int) store.StoreChannel); ok { + r0 = rf(channelId, postId, numPosts, offset) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetPostsByIds provides a mock function with given fields: postIds +func (_m *PostStore) GetPostsByIds(postIds []string) store.StoreChannel { + ret := _m.Called(postIds) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func([]string) store.StoreChannel); ok { + r0 = rf(postIds) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetPostsCreatedAt provides a mock function with given fields: channelId, time +func (_m *PostStore) GetPostsCreatedAt(channelId string, time int64) store.StoreChannel { + ret := _m.Called(channelId, time) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64) store.StoreChannel); ok { + r0 = rf(channelId, time) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetPostsSince provides a mock function with given fields: channelId, time, allowFromCache +func (_m *PostStore) GetPostsSince(channelId string, time int64, allowFromCache bool) store.StoreChannel { + ret := _m.Called(channelId, time, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64, bool) store.StoreChannel); ok { + r0 = rf(channelId, time, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetSingle provides a mock function with given fields: id +func (_m *PostStore) GetSingle(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// InvalidateLastPostTimeCache provides a mock function with given fields: channelId +func (_m *PostStore) InvalidateLastPostTimeCache(channelId string) { + _m.Called(channelId) +} + +// Overwrite provides a mock function with given fields: post +func (_m *PostStore) Overwrite(post *model.Post) store.StoreChannel { + ret := _m.Called(post) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Post) store.StoreChannel); ok { + r0 = rf(post) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteBatch provides a mock function with given fields: endTime, limit +func (_m *PostStore) PermanentDeleteBatch(endTime int64, limit int64) store.StoreChannel { + ret := _m.Called(endTime, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int64, int64) store.StoreChannel); ok { + r0 = rf(endTime, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteByChannel provides a mock function with given fields: channelId +func (_m *PostStore) PermanentDeleteByChannel(channelId string) store.StoreChannel { + ret := _m.Called(channelId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(channelId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteByUser provides a mock function with given fields: userId +func (_m *PostStore) PermanentDeleteByUser(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: post +func (_m *PostStore) Save(post *model.Post) store.StoreChannel { + ret := _m.Called(post) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Post) store.StoreChannel); ok { + r0 = rf(post) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Search provides a mock function with given fields: teamId, userId, params +func (_m *PostStore) Search(teamId string, userId string, params *model.SearchParams) store.StoreChannel { + ret := _m.Called(teamId, userId, params) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, *model.SearchParams) store.StoreChannel); ok { + r0 = rf(teamId, userId, params) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Update provides a mock function with given fields: newPost, oldPost +func (_m *PostStore) Update(newPost *model.Post, oldPost *model.Post) store.StoreChannel { + ret := _m.Called(newPost, oldPost) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Post, *model.Post) store.StoreChannel); ok { + r0 = rf(newPost, oldPost) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/PreferenceStore.go b/store/storetest/mocks/PreferenceStore.go new file mode 100644 index 000000000..5ad56914a --- /dev/null +++ b/store/storetest/mocks/PreferenceStore.go @@ -0,0 +1,174 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// PreferenceStore is an autogenerated mock type for the PreferenceStore type +type PreferenceStore struct { + mock.Mock +} + +// CleanupFlagsBatch provides a mock function with given fields: limit +func (_m *PreferenceStore) CleanupFlagsBatch(limit int64) store.StoreChannel { + ret := _m.Called(limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int64) store.StoreChannel); ok { + r0 = rf(limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Delete provides a mock function with given fields: userId, category, name +func (_m *PreferenceStore) Delete(userId string, category string, name string) store.StoreChannel { + ret := _m.Called(userId, category, name) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, string) store.StoreChannel); ok { + r0 = rf(userId, category, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// DeleteCategory provides a mock function with given fields: userId, category +func (_m *PreferenceStore) DeleteCategory(userId string, category string) store.StoreChannel { + ret := _m.Called(userId, category) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(userId, category) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// DeleteCategoryAndName provides a mock function with given fields: category, name +func (_m *PreferenceStore) DeleteCategoryAndName(category string, name string) store.StoreChannel { + ret := _m.Called(category, name) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(category, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: userId, category, name +func (_m *PreferenceStore) Get(userId string, category string, name string) store.StoreChannel { + ret := _m.Called(userId, category, name) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, string) store.StoreChannel); ok { + r0 = rf(userId, category, name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAll provides a mock function with given fields: userId +func (_m *PreferenceStore) GetAll(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetCategory provides a mock function with given fields: userId, category +func (_m *PreferenceStore) GetCategory(userId string, category string) store.StoreChannel { + ret := _m.Called(userId, category) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(userId, category) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// IsFeatureEnabled provides a mock function with given fields: feature, userId +func (_m *PreferenceStore) IsFeatureEnabled(feature string, userId string) store.StoreChannel { + ret := _m.Called(feature, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(feature, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteByUser provides a mock function with given fields: userId +func (_m *PreferenceStore) PermanentDeleteByUser(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: preferences +func (_m *PreferenceStore) Save(preferences *model.Preferences) store.StoreChannel { + ret := _m.Called(preferences) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Preferences) store.StoreChannel); ok { + r0 = rf(preferences) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/ReactionStore.go b/store/storetest/mocks/ReactionStore.go new file mode 100644 index 000000000..ce09f3f76 --- /dev/null +++ b/store/storetest/mocks/ReactionStore.go @@ -0,0 +1,94 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// ReactionStore is an autogenerated mock type for the ReactionStore type +type ReactionStore struct { + mock.Mock +} + +// Delete provides a mock function with given fields: reaction +func (_m *ReactionStore) Delete(reaction *model.Reaction) store.StoreChannel { + ret := _m.Called(reaction) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Reaction) store.StoreChannel); ok { + r0 = rf(reaction) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// DeleteAllWithEmojiName provides a mock function with given fields: emojiName +func (_m *ReactionStore) DeleteAllWithEmojiName(emojiName string) store.StoreChannel { + ret := _m.Called(emojiName) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(emojiName) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetForPost provides a mock function with given fields: postId, allowFromCache +func (_m *ReactionStore) GetForPost(postId string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(postId, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool) store.StoreChannel); ok { + r0 = rf(postId, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteBatch provides a mock function with given fields: endTime, limit +func (_m *ReactionStore) PermanentDeleteBatch(endTime int64, limit int64) store.StoreChannel { + ret := _m.Called(endTime, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int64, int64) store.StoreChannel); ok { + r0 = rf(endTime, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: reaction +func (_m *ReactionStore) Save(reaction *model.Reaction) store.StoreChannel { + ret := _m.Called(reaction) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Reaction) store.StoreChannel); ok { + r0 = rf(reaction) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/SessionStore.go b/store/storetest/mocks/SessionStore.go new file mode 100644 index 000000000..1bec89e11 --- /dev/null +++ b/store/storetest/mocks/SessionStore.go @@ -0,0 +1,190 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// SessionStore is an autogenerated mock type for the SessionStore type +type SessionStore struct { + mock.Mock +} + +// AnalyticsSessionCount provides a mock function with given fields: +func (_m *SessionStore) AnalyticsSessionCount() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: sessionIdOrToken +func (_m *SessionStore) Get(sessionIdOrToken string) store.StoreChannel { + ret := _m.Called(sessionIdOrToken) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(sessionIdOrToken) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetSessions provides a mock function with given fields: userId +func (_m *SessionStore) GetSessions(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetSessionsWithActiveDeviceIds provides a mock function with given fields: userId +func (_m *SessionStore) GetSessionsWithActiveDeviceIds(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteSessionsByUser provides a mock function with given fields: teamId +func (_m *SessionStore) PermanentDeleteSessionsByUser(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Remove provides a mock function with given fields: sessionIdOrToken +func (_m *SessionStore) Remove(sessionIdOrToken string) store.StoreChannel { + ret := _m.Called(sessionIdOrToken) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(sessionIdOrToken) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// RemoveAllSessions provides a mock function with given fields: +func (_m *SessionStore) RemoveAllSessions() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: session +func (_m *SessionStore) Save(session *model.Session) store.StoreChannel { + ret := _m.Called(session) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Session) store.StoreChannel); ok { + r0 = rf(session) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateDeviceId provides a mock function with given fields: id, deviceId, expiresAt +func (_m *SessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) store.StoreChannel { + ret := _m.Called(id, deviceId, expiresAt) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, int64) store.StoreChannel); ok { + r0 = rf(id, deviceId, expiresAt) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateLastActivityAt provides a mock function with given fields: sessionId, time +func (_m *SessionStore) UpdateLastActivityAt(sessionId string, time int64) store.StoreChannel { + ret := _m.Called(sessionId, time) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64) store.StoreChannel); ok { + r0 = rf(sessionId, time) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateRoles provides a mock function with given fields: userId, roles +func (_m *SessionStore) UpdateRoles(userId string, roles string) store.StoreChannel { + ret := _m.Called(userId, roles) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(userId, roles) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/SqlStore.go b/store/storetest/mocks/SqlStore.go new file mode 100644 index 000000000..eda8cb39e --- /dev/null +++ b/store/storetest/mocks/SqlStore.go @@ -0,0 +1,679 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import gorp "github.com/mattermost/gorp" +import mock "github.com/stretchr/testify/mock" + +import store "github.com/mattermost/mattermost-server/store" + +// SqlStore is an autogenerated mock type for the SqlStore type +type SqlStore struct { + mock.Mock +} + +// AlterColumnTypeIfExists provides a mock function with given fields: tableName, columnName, mySqlColType, postgresColType +func (_m *SqlStore) AlterColumnTypeIfExists(tableName string, columnName string, mySqlColType string, postgresColType string) bool { + ret := _m.Called(tableName, columnName, mySqlColType, postgresColType) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string, string, string) bool); ok { + r0 = rf(tableName, columnName, mySqlColType, postgresColType) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// Audit provides a mock function with given fields: +func (_m *SqlStore) Audit() store.AuditStore { + ret := _m.Called() + + var r0 store.AuditStore + if rf, ok := ret.Get(0).(func() store.AuditStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.AuditStore) + } + } + + return r0 +} + +// Channel provides a mock function with given fields: +func (_m *SqlStore) Channel() store.ChannelStore { + ret := _m.Called() + + var r0 store.ChannelStore + if rf, ok := ret.Get(0).(func() store.ChannelStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ChannelStore) + } + } + + return r0 +} + +// Close provides a mock function with given fields: +func (_m *SqlStore) Close() { + _m.Called() +} + +// ClusterDiscovery provides a mock function with given fields: +func (_m *SqlStore) ClusterDiscovery() store.ClusterDiscoveryStore { + ret := _m.Called() + + var r0 store.ClusterDiscoveryStore + if rf, ok := ret.Get(0).(func() store.ClusterDiscoveryStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ClusterDiscoveryStore) + } + } + + return r0 +} + +// Command provides a mock function with given fields: +func (_m *SqlStore) Command() store.CommandStore { + ret := _m.Called() + + var r0 store.CommandStore + if rf, ok := ret.Get(0).(func() store.CommandStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.CommandStore) + } + } + + return r0 +} + +// CommandWebhook provides a mock function with given fields: +func (_m *SqlStore) CommandWebhook() store.CommandWebhookStore { + ret := _m.Called() + + var r0 store.CommandWebhookStore + if rf, ok := ret.Get(0).(func() store.CommandWebhookStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.CommandWebhookStore) + } + } + + return r0 +} + +// Compliance provides a mock function with given fields: +func (_m *SqlStore) Compliance() store.ComplianceStore { + ret := _m.Called() + + var r0 store.ComplianceStore + if rf, ok := ret.Get(0).(func() store.ComplianceStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ComplianceStore) + } + } + + return r0 +} + +// CreateColumnIfNotExists provides a mock function with given fields: tableName, columnName, mySqlColType, postgresColType, defaultValue +func (_m *SqlStore) CreateColumnIfNotExists(tableName string, columnName string, mySqlColType string, postgresColType string, defaultValue string) bool { + ret := _m.Called(tableName, columnName, mySqlColType, postgresColType, defaultValue) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string, string, string, string) bool); ok { + r0 = rf(tableName, columnName, mySqlColType, postgresColType, defaultValue) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// CreateFullTextIndexIfNotExists provides a mock function with given fields: indexName, tableName, columnName +func (_m *SqlStore) CreateFullTextIndexIfNotExists(indexName string, tableName string, columnName string) bool { + ret := _m.Called(indexName, tableName, columnName) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string, string) bool); ok { + r0 = rf(indexName, tableName, columnName) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// CreateIndexIfNotExists provides a mock function with given fields: indexName, tableName, columnName +func (_m *SqlStore) CreateIndexIfNotExists(indexName string, tableName string, columnName string) bool { + ret := _m.Called(indexName, tableName, columnName) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string, string) bool); ok { + r0 = rf(indexName, tableName, columnName) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// CreateUniqueIndexIfNotExists provides a mock function with given fields: indexName, tableName, columnName +func (_m *SqlStore) CreateUniqueIndexIfNotExists(indexName string, tableName string, columnName string) bool { + ret := _m.Called(indexName, tableName, columnName) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string, string) bool); ok { + r0 = rf(indexName, tableName, columnName) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// DoesColumnExist provides a mock function with given fields: tableName, columName +func (_m *SqlStore) DoesColumnExist(tableName string, columName string) bool { + ret := _m.Called(tableName, columName) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string) bool); ok { + r0 = rf(tableName, columName) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// DoesTableExist provides a mock function with given fields: tablename +func (_m *SqlStore) DoesTableExist(tablename string) bool { + ret := _m.Called(tablename) + + var r0 bool + if rf, ok := ret.Get(0).(func(string) bool); ok { + r0 = rf(tablename) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// DriverName provides a mock function with given fields: +func (_m *SqlStore) DriverName() 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 +} + +// Emoji provides a mock function with given fields: +func (_m *SqlStore) Emoji() store.EmojiStore { + ret := _m.Called() + + var r0 store.EmojiStore + if rf, ok := ret.Get(0).(func() store.EmojiStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.EmojiStore) + } + } + + return r0 +} + +// FileInfo provides a mock function with given fields: +func (_m *SqlStore) FileInfo() store.FileInfoStore { + ret := _m.Called() + + var r0 store.FileInfoStore + if rf, ok := ret.Get(0).(func() store.FileInfoStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.FileInfoStore) + } + } + + return r0 +} + +// GetAllConns provides a mock function with given fields: +func (_m *SqlStore) GetAllConns() []*gorp.DbMap { + ret := _m.Called() + + var r0 []*gorp.DbMap + if rf, ok := ret.Get(0).(func() []*gorp.DbMap); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*gorp.DbMap) + } + } + + return r0 +} + +// GetCurrentSchemaVersion provides a mock function with given fields: +func (_m *SqlStore) GetCurrentSchemaVersion() 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 +} + +// GetMaster provides a mock function with given fields: +func (_m *SqlStore) GetMaster() *gorp.DbMap { + ret := _m.Called() + + var r0 *gorp.DbMap + if rf, ok := ret.Get(0).(func() *gorp.DbMap); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gorp.DbMap) + } + } + + return r0 +} + +// GetMaxLengthOfColumnIfExists provides a mock function with given fields: tableName, columnName +func (_m *SqlStore) GetMaxLengthOfColumnIfExists(tableName string, columnName string) string { + ret := _m.Called(tableName, columnName) + + var r0 string + if rf, ok := ret.Get(0).(func(string, string) string); ok { + r0 = rf(tableName, columnName) + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// GetReplica provides a mock function with given fields: +func (_m *SqlStore) GetReplica() *gorp.DbMap { + ret := _m.Called() + + var r0 *gorp.DbMap + if rf, ok := ret.Get(0).(func() *gorp.DbMap); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gorp.DbMap) + } + } + + return r0 +} + +// GetSearchReplica provides a mock function with given fields: +func (_m *SqlStore) GetSearchReplica() *gorp.DbMap { + ret := _m.Called() + + var r0 *gorp.DbMap + if rf, ok := ret.Get(0).(func() *gorp.DbMap); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gorp.DbMap) + } + } + + return r0 +} + +// Job provides a mock function with given fields: +func (_m *SqlStore) Job() store.JobStore { + ret := _m.Called() + + var r0 store.JobStore + if rf, ok := ret.Get(0).(func() store.JobStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.JobStore) + } + } + + return r0 +} + +// License provides a mock function with given fields: +func (_m *SqlStore) License() store.LicenseStore { + ret := _m.Called() + + var r0 store.LicenseStore + if rf, ok := ret.Get(0).(func() store.LicenseStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.LicenseStore) + } + } + + return r0 +} + +// MarkSystemRanUnitTests provides a mock function with given fields: +func (_m *SqlStore) MarkSystemRanUnitTests() { + _m.Called() +} + +// OAuth provides a mock function with given fields: +func (_m *SqlStore) OAuth() store.OAuthStore { + ret := _m.Called() + + var r0 store.OAuthStore + if rf, ok := ret.Get(0).(func() store.OAuthStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.OAuthStore) + } + } + + return r0 +} + +// Post provides a mock function with given fields: +func (_m *SqlStore) Post() store.PostStore { + ret := _m.Called() + + var r0 store.PostStore + if rf, ok := ret.Get(0).(func() store.PostStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.PostStore) + } + } + + return r0 +} + +// Preference provides a mock function with given fields: +func (_m *SqlStore) Preference() store.PreferenceStore { + ret := _m.Called() + + var r0 store.PreferenceStore + if rf, ok := ret.Get(0).(func() store.PreferenceStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.PreferenceStore) + } + } + + return r0 +} + +// Reaction provides a mock function with given fields: +func (_m *SqlStore) Reaction() store.ReactionStore { + ret := _m.Called() + + var r0 store.ReactionStore + if rf, ok := ret.Get(0).(func() store.ReactionStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ReactionStore) + } + } + + return r0 +} + +// RemoveColumnIfExists provides a mock function with given fields: tableName, columnName +func (_m *SqlStore) RemoveColumnIfExists(tableName string, columnName string) bool { + ret := _m.Called(tableName, columnName) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string) bool); ok { + r0 = rf(tableName, columnName) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// RemoveIndexIfExists provides a mock function with given fields: indexName, tableName +func (_m *SqlStore) RemoveIndexIfExists(indexName string, tableName string) bool { + ret := _m.Called(indexName, tableName) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string) bool); ok { + r0 = rf(indexName, tableName) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// RemoveTableIfExists provides a mock function with given fields: tableName +func (_m *SqlStore) RemoveTableIfExists(tableName string) bool { + ret := _m.Called(tableName) + + var r0 bool + if rf, ok := ret.Get(0).(func(string) bool); ok { + r0 = rf(tableName) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// RenameColumnIfExists provides a mock function with given fields: tableName, oldColumnName, newColumnName, colType +func (_m *SqlStore) RenameColumnIfExists(tableName string, oldColumnName string, newColumnName string, colType string) bool { + ret := _m.Called(tableName, oldColumnName, newColumnName, colType) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string, string, string) bool); ok { + r0 = rf(tableName, oldColumnName, newColumnName, colType) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// Session provides a mock function with given fields: +func (_m *SqlStore) Session() store.SessionStore { + ret := _m.Called() + + var r0 store.SessionStore + if rf, ok := ret.Get(0).(func() store.SessionStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.SessionStore) + } + } + + return r0 +} + +// Status provides a mock function with given fields: +func (_m *SqlStore) Status() store.StatusStore { + ret := _m.Called() + + var r0 store.StatusStore + if rf, ok := ret.Get(0).(func() store.StatusStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StatusStore) + } + } + + return r0 +} + +// System provides a mock function with given fields: +func (_m *SqlStore) System() store.SystemStore { + ret := _m.Called() + + var r0 store.SystemStore + if rf, ok := ret.Get(0).(func() store.SystemStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.SystemStore) + } + } + + return r0 +} + +// Team provides a mock function with given fields: +func (_m *SqlStore) Team() store.TeamStore { + ret := _m.Called() + + var r0 store.TeamStore + if rf, ok := ret.Get(0).(func() store.TeamStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.TeamStore) + } + } + + return r0 +} + +// Token provides a mock function with given fields: +func (_m *SqlStore) Token() store.TokenStore { + ret := _m.Called() + + var r0 store.TokenStore + if rf, ok := ret.Get(0).(func() store.TokenStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.TokenStore) + } + } + + return r0 +} + +// TotalMasterDbConnections provides a mock function with given fields: +func (_m *SqlStore) TotalMasterDbConnections() 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 +} + +// TotalReadDbConnections provides a mock function with given fields: +func (_m *SqlStore) TotalReadDbConnections() 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 +} + +// TotalSearchDbConnections provides a mock function with given fields: +func (_m *SqlStore) TotalSearchDbConnections() 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 +} + +// User provides a mock function with given fields: +func (_m *SqlStore) User() store.UserStore { + ret := _m.Called() + + var r0 store.UserStore + if rf, ok := ret.Get(0).(func() store.UserStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.UserStore) + } + } + + return r0 +} + +// UserAccessToken provides a mock function with given fields: +func (_m *SqlStore) UserAccessToken() store.UserAccessTokenStore { + ret := _m.Called() + + var r0 store.UserAccessTokenStore + if rf, ok := ret.Get(0).(func() store.UserAccessTokenStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.UserAccessTokenStore) + } + } + + return r0 +} + +// Webhook provides a mock function with given fields: +func (_m *SqlStore) Webhook() store.WebhookStore { + ret := _m.Called() + + var r0 store.WebhookStore + if rf, ok := ret.Get(0).(func() store.WebhookStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.WebhookStore) + } + } + + return r0 +} diff --git a/store/storetest/mocks/StatusStore.go b/store/storetest/mocks/StatusStore.go new file mode 100644 index 000000000..4acb90bdd --- /dev/null +++ b/store/storetest/mocks/StatusStore.go @@ -0,0 +1,158 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// StatusStore is an autogenerated mock type for the StatusStore type +type StatusStore struct { + mock.Mock +} + +// Get provides a mock function with given fields: userId +func (_m *StatusStore) Get(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllFromTeam provides a mock function with given fields: teamId +func (_m *StatusStore) GetAllFromTeam(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByIds provides a mock function with given fields: userIds +func (_m *StatusStore) GetByIds(userIds []string) store.StoreChannel { + ret := _m.Called(userIds) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func([]string) store.StoreChannel); ok { + r0 = rf(userIds) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetOnline provides a mock function with given fields: +func (_m *StatusStore) GetOnline() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetOnlineAway provides a mock function with given fields: +func (_m *StatusStore) GetOnlineAway() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetTotalActiveUsersCount provides a mock function with given fields: +func (_m *StatusStore) GetTotalActiveUsersCount() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// ResetAll provides a mock function with given fields: +func (_m *StatusStore) ResetAll() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SaveOrUpdate provides a mock function with given fields: status +func (_m *StatusStore) SaveOrUpdate(status *model.Status) store.StoreChannel { + ret := _m.Called(status) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Status) store.StoreChannel); ok { + r0 = rf(status) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateLastActivityAt provides a mock function with given fields: userId, lastActivityAt +func (_m *StatusStore) UpdateLastActivityAt(userId string, lastActivityAt int64) store.StoreChannel { + ret := _m.Called(userId, lastActivityAt) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64) store.StoreChannel); ok { + r0 = rf(userId, lastActivityAt) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/Store.go b/store/storetest/mocks/Store.go new file mode 100644 index 000000000..166b5b98a --- /dev/null +++ b/store/storetest/mocks/Store.go @@ -0,0 +1,422 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import store "github.com/mattermost/mattermost-server/store" + +// Store is an autogenerated mock type for the Store type +type Store struct { + mock.Mock +} + +// Audit provides a mock function with given fields: +func (_m *Store) Audit() store.AuditStore { + ret := _m.Called() + + var r0 store.AuditStore + if rf, ok := ret.Get(0).(func() store.AuditStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.AuditStore) + } + } + + return r0 +} + +// Channel provides a mock function with given fields: +func (_m *Store) Channel() store.ChannelStore { + ret := _m.Called() + + var r0 store.ChannelStore + if rf, ok := ret.Get(0).(func() store.ChannelStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ChannelStore) + } + } + + return r0 +} + +// Close provides a mock function with given fields: +func (_m *Store) Close() { + _m.Called() +} + +// ClusterDiscovery provides a mock function with given fields: +func (_m *Store) ClusterDiscovery() store.ClusterDiscoveryStore { + ret := _m.Called() + + var r0 store.ClusterDiscoveryStore + if rf, ok := ret.Get(0).(func() store.ClusterDiscoveryStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ClusterDiscoveryStore) + } + } + + return r0 +} + +// Command provides a mock function with given fields: +func (_m *Store) Command() store.CommandStore { + ret := _m.Called() + + var r0 store.CommandStore + if rf, ok := ret.Get(0).(func() store.CommandStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.CommandStore) + } + } + + return r0 +} + +// CommandWebhook provides a mock function with given fields: +func (_m *Store) CommandWebhook() store.CommandWebhookStore { + ret := _m.Called() + + var r0 store.CommandWebhookStore + if rf, ok := ret.Get(0).(func() store.CommandWebhookStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.CommandWebhookStore) + } + } + + return r0 +} + +// Compliance provides a mock function with given fields: +func (_m *Store) Compliance() store.ComplianceStore { + ret := _m.Called() + + var r0 store.ComplianceStore + if rf, ok := ret.Get(0).(func() store.ComplianceStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ComplianceStore) + } + } + + return r0 +} + +// DropAllTables provides a mock function with given fields: +func (_m *Store) DropAllTables() { + _m.Called() +} + +// Emoji provides a mock function with given fields: +func (_m *Store) Emoji() store.EmojiStore { + ret := _m.Called() + + var r0 store.EmojiStore + if rf, ok := ret.Get(0).(func() store.EmojiStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.EmojiStore) + } + } + + return r0 +} + +// FileInfo provides a mock function with given fields: +func (_m *Store) FileInfo() store.FileInfoStore { + ret := _m.Called() + + var r0 store.FileInfoStore + if rf, ok := ret.Get(0).(func() store.FileInfoStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.FileInfoStore) + } + } + + return r0 +} + +// Job provides a mock function with given fields: +func (_m *Store) Job() store.JobStore { + ret := _m.Called() + + var r0 store.JobStore + if rf, ok := ret.Get(0).(func() store.JobStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.JobStore) + } + } + + return r0 +} + +// License provides a mock function with given fields: +func (_m *Store) License() store.LicenseStore { + ret := _m.Called() + + var r0 store.LicenseStore + if rf, ok := ret.Get(0).(func() store.LicenseStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.LicenseStore) + } + } + + return r0 +} + +// MarkSystemRanUnitTests provides a mock function with given fields: +func (_m *Store) MarkSystemRanUnitTests() { + _m.Called() +} + +// OAuth provides a mock function with given fields: +func (_m *Store) OAuth() store.OAuthStore { + ret := _m.Called() + + var r0 store.OAuthStore + if rf, ok := ret.Get(0).(func() store.OAuthStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.OAuthStore) + } + } + + return r0 +} + +// Post provides a mock function with given fields: +func (_m *Store) Post() store.PostStore { + ret := _m.Called() + + var r0 store.PostStore + if rf, ok := ret.Get(0).(func() store.PostStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.PostStore) + } + } + + return r0 +} + +// Preference provides a mock function with given fields: +func (_m *Store) Preference() store.PreferenceStore { + ret := _m.Called() + + var r0 store.PreferenceStore + if rf, ok := ret.Get(0).(func() store.PreferenceStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.PreferenceStore) + } + } + + return r0 +} + +// Reaction provides a mock function with given fields: +func (_m *Store) Reaction() store.ReactionStore { + ret := _m.Called() + + var r0 store.ReactionStore + if rf, ok := ret.Get(0).(func() store.ReactionStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.ReactionStore) + } + } + + return r0 +} + +// Session provides a mock function with given fields: +func (_m *Store) Session() store.SessionStore { + ret := _m.Called() + + var r0 store.SessionStore + if rf, ok := ret.Get(0).(func() store.SessionStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.SessionStore) + } + } + + return r0 +} + +// Status provides a mock function with given fields: +func (_m *Store) Status() store.StatusStore { + ret := _m.Called() + + var r0 store.StatusStore + if rf, ok := ret.Get(0).(func() store.StatusStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StatusStore) + } + } + + return r0 +} + +// System provides a mock function with given fields: +func (_m *Store) System() store.SystemStore { + ret := _m.Called() + + var r0 store.SystemStore + if rf, ok := ret.Get(0).(func() store.SystemStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.SystemStore) + } + } + + return r0 +} + +// Team provides a mock function with given fields: +func (_m *Store) Team() store.TeamStore { + ret := _m.Called() + + var r0 store.TeamStore + if rf, ok := ret.Get(0).(func() store.TeamStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.TeamStore) + } + } + + return r0 +} + +// Token provides a mock function with given fields: +func (_m *Store) Token() store.TokenStore { + ret := _m.Called() + + var r0 store.TokenStore + if rf, ok := ret.Get(0).(func() store.TokenStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.TokenStore) + } + } + + return r0 +} + +// TotalMasterDbConnections provides a mock function with given fields: +func (_m *Store) TotalMasterDbConnections() 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 +} + +// TotalReadDbConnections provides a mock function with given fields: +func (_m *Store) TotalReadDbConnections() 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 +} + +// TotalSearchDbConnections provides a mock function with given fields: +func (_m *Store) TotalSearchDbConnections() 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 +} + +// User provides a mock function with given fields: +func (_m *Store) User() store.UserStore { + ret := _m.Called() + + var r0 store.UserStore + if rf, ok := ret.Get(0).(func() store.UserStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.UserStore) + } + } + + return r0 +} + +// UserAccessToken provides a mock function with given fields: +func (_m *Store) UserAccessToken() store.UserAccessTokenStore { + ret := _m.Called() + + var r0 store.UserAccessTokenStore + if rf, ok := ret.Get(0).(func() store.UserAccessTokenStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.UserAccessTokenStore) + } + } + + return r0 +} + +// Webhook provides a mock function with given fields: +func (_m *Store) Webhook() store.WebhookStore { + ret := _m.Called() + + var r0 store.WebhookStore + if rf, ok := ret.Get(0).(func() store.WebhookStore); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.WebhookStore) + } + } + + return r0 +} diff --git a/store/storetest/mocks/SystemStore.go b/store/storetest/mocks/SystemStore.go new file mode 100644 index 000000000..2c5774fcf --- /dev/null +++ b/store/storetest/mocks/SystemStore.go @@ -0,0 +1,94 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// SystemStore is an autogenerated mock type for the SystemStore type +type SystemStore struct { + mock.Mock +} + +// Get provides a mock function with given fields: +func (_m *SystemStore) Get() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByName provides a mock function with given fields: name +func (_m *SystemStore) GetByName(name string) store.StoreChannel { + ret := _m.Called(name) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: system +func (_m *SystemStore) Save(system *model.System) store.StoreChannel { + ret := _m.Called(system) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.System) store.StoreChannel); ok { + r0 = rf(system) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SaveOrUpdate provides a mock function with given fields: system +func (_m *SystemStore) SaveOrUpdate(system *model.System) store.StoreChannel { + ret := _m.Called(system) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.System) store.StoreChannel); ok { + r0 = rf(system) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Update provides a mock function with given fields: system +func (_m *SystemStore) Update(system *model.System) store.StoreChannel { + ret := _m.Called(system) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.System) store.StoreChannel); ok { + r0 = rf(system) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/TeamStore.go b/store/storetest/mocks/TeamStore.go new file mode 100644 index 000000000..bdad7f81b --- /dev/null +++ b/store/storetest/mocks/TeamStore.go @@ -0,0 +1,478 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// TeamStore is an autogenerated mock type for the TeamStore type +type TeamStore struct { + mock.Mock +} + +// AnalyticsTeamCount provides a mock function with given fields: +func (_m *TeamStore) AnalyticsTeamCount() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: id +func (_m *TeamStore) Get(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetActiveMemberCount provides a mock function with given fields: teamId +func (_m *TeamStore) GetActiveMemberCount(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAll provides a mock function with given fields: +func (_m *TeamStore) GetAll() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllPage provides a mock function with given fields: offset, limit +func (_m *TeamStore) GetAllPage(offset int, limit int) store.StoreChannel { + ret := _m.Called(offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int, int) store.StoreChannel); ok { + r0 = rf(offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllTeamListing provides a mock function with given fields: +func (_m *TeamStore) GetAllTeamListing() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllTeamPageListing provides a mock function with given fields: offset, limit +func (_m *TeamStore) GetAllTeamPageListing(offset int, limit int) store.StoreChannel { + ret := _m.Called(offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int, int) store.StoreChannel); ok { + r0 = rf(offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByInviteId provides a mock function with given fields: inviteId +func (_m *TeamStore) GetByInviteId(inviteId string) store.StoreChannel { + ret := _m.Called(inviteId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(inviteId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByName provides a mock function with given fields: name +func (_m *TeamStore) GetByName(name string) store.StoreChannel { + ret := _m.Called(name) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetChannelUnreadsForAllTeams provides a mock function with given fields: excludeTeamId, userId +func (_m *TeamStore) GetChannelUnreadsForAllTeams(excludeTeamId string, userId string) store.StoreChannel { + ret := _m.Called(excludeTeamId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(excludeTeamId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetChannelUnreadsForTeam provides a mock function with given fields: teamId, userId +func (_m *TeamStore) GetChannelUnreadsForTeam(teamId string, userId string) store.StoreChannel { + ret := _m.Called(teamId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(teamId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetMember provides a mock function with given fields: teamId, userId +func (_m *TeamStore) GetMember(teamId string, userId string) store.StoreChannel { + ret := _m.Called(teamId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(teamId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetMembers provides a mock function with given fields: teamId, offset, limit +func (_m *TeamStore) GetMembers(teamId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(teamId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(teamId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetMembersByIds provides a mock function with given fields: teamId, userIds +func (_m *TeamStore) GetMembersByIds(teamId string, userIds []string) store.StoreChannel { + ret := _m.Called(teamId, userIds) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, []string) store.StoreChannel); ok { + r0 = rf(teamId, userIds) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetTeamsByUserId provides a mock function with given fields: userId +func (_m *TeamStore) GetTeamsByUserId(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetTeamsForUser provides a mock function with given fields: userId +func (_m *TeamStore) GetTeamsForUser(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetTotalMemberCount provides a mock function with given fields: teamId +func (_m *TeamStore) GetTotalMemberCount(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDelete provides a mock function with given fields: teamId +func (_m *TeamStore) PermanentDelete(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// RemoveAllMembersByTeam provides a mock function with given fields: teamId +func (_m *TeamStore) RemoveAllMembersByTeam(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// RemoveAllMembersByUser provides a mock function with given fields: userId +func (_m *TeamStore) RemoveAllMembersByUser(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// RemoveMember provides a mock function with given fields: teamId, userId +func (_m *TeamStore) RemoveMember(teamId string, userId string) store.StoreChannel { + ret := _m.Called(teamId, userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(teamId, userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: team +func (_m *TeamStore) Save(team *model.Team) store.StoreChannel { + ret := _m.Called(team) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Team) store.StoreChannel); ok { + r0 = rf(team) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SaveMember provides a mock function with given fields: member, maxUsersPerTeam +func (_m *TeamStore) SaveMember(member *model.TeamMember, maxUsersPerTeam int) store.StoreChannel { + ret := _m.Called(member, maxUsersPerTeam) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.TeamMember, int) store.StoreChannel); ok { + r0 = rf(member, maxUsersPerTeam) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SearchAll provides a mock function with given fields: term +func (_m *TeamStore) SearchAll(term string) store.StoreChannel { + ret := _m.Called(term) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(term) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SearchByName provides a mock function with given fields: name +func (_m *TeamStore) SearchByName(name string) store.StoreChannel { + ret := _m.Called(name) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SearchOpen provides a mock function with given fields: term +func (_m *TeamStore) SearchOpen(term string) store.StoreChannel { + ret := _m.Called(term) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(term) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Update provides a mock function with given fields: team +func (_m *TeamStore) Update(team *model.Team) store.StoreChannel { + ret := _m.Called(team) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Team) store.StoreChannel); ok { + r0 = rf(team) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateDisplayName provides a mock function with given fields: name, teamId +func (_m *TeamStore) UpdateDisplayName(name string, teamId string) store.StoreChannel { + ret := _m.Called(name, teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(name, teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateMember provides a mock function with given fields: member +func (_m *TeamStore) UpdateMember(member *model.TeamMember) store.StoreChannel { + ret := _m.Called(member) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.TeamMember) store.StoreChannel); ok { + r0 = rf(member) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/TokenStore.go b/store/storetest/mocks/TokenStore.go new file mode 100644 index 000000000..b4baacf03 --- /dev/null +++ b/store/storetest/mocks/TokenStore.go @@ -0,0 +1,67 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// TokenStore is an autogenerated mock type for the TokenStore type +type TokenStore struct { + mock.Mock +} + +// Cleanup provides a mock function with given fields: +func (_m *TokenStore) Cleanup() { + _m.Called() +} + +// Delete provides a mock function with given fields: token +func (_m *TokenStore) Delete(token string) store.StoreChannel { + ret := _m.Called(token) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(token) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByToken provides a mock function with given fields: token +func (_m *TokenStore) GetByToken(token string) store.StoreChannel { + ret := _m.Called(token) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(token) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: recovery +func (_m *TokenStore) Save(recovery *model.Token) store.StoreChannel { + ret := _m.Called(recovery) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.Token) store.StoreChannel); ok { + r0 = rf(recovery) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/UserAccessTokenStore.go b/store/storetest/mocks/UserAccessTokenStore.go new file mode 100644 index 000000000..87541fd76 --- /dev/null +++ b/store/storetest/mocks/UserAccessTokenStore.go @@ -0,0 +1,142 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// UserAccessTokenStore is an autogenerated mock type for the UserAccessTokenStore type +type UserAccessTokenStore struct { + mock.Mock +} + +// Delete provides a mock function with given fields: tokenId +func (_m *UserAccessTokenStore) Delete(tokenId string) store.StoreChannel { + ret := _m.Called(tokenId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(tokenId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// DeleteAllForUser provides a mock function with given fields: userId +func (_m *UserAccessTokenStore) DeleteAllForUser(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: tokenId +func (_m *UserAccessTokenStore) Get(tokenId string) store.StoreChannel { + ret := _m.Called(tokenId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(tokenId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByToken provides a mock function with given fields: tokenString +func (_m *UserAccessTokenStore) GetByToken(tokenString string) store.StoreChannel { + ret := _m.Called(tokenString) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(tokenString) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByUser provides a mock function with given fields: userId, page, perPage +func (_m *UserAccessTokenStore) GetByUser(userId string, page int, perPage int) store.StoreChannel { + ret := _m.Called(userId, page, perPage) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(userId, page, perPage) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: token +func (_m *UserAccessTokenStore) Save(token *model.UserAccessToken) store.StoreChannel { + ret := _m.Called(token) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.UserAccessToken) store.StoreChannel); ok { + r0 = rf(token) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateTokenDisable provides a mock function with given fields: tokenId +func (_m *UserAccessTokenStore) UpdateTokenDisable(tokenId string) store.StoreChannel { + ret := _m.Called(tokenId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(tokenId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateTokenEnable provides a mock function with given fields: tokenId +func (_m *UserAccessTokenStore) UpdateTokenEnable(tokenId string) store.StoreChannel { + ret := _m.Called(tokenId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(tokenId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/UserStore.go b/store/storetest/mocks/UserStore.go new file mode 100644 index 000000000..7d1fd8c38 --- /dev/null +++ b/store/storetest/mocks/UserStore.go @@ -0,0 +1,749 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// UserStore is an autogenerated mock type for the UserStore type +type UserStore struct { + mock.Mock +} + +// AnalyticsActiveCount provides a mock function with given fields: time +func (_m *UserStore) AnalyticsActiveCount(time int64) store.StoreChannel { + ret := _m.Called(time) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int64) store.StoreChannel); ok { + r0 = rf(time) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// AnalyticsGetInactiveUsersCount provides a mock function with given fields: +func (_m *UserStore) AnalyticsGetInactiveUsersCount() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// AnalyticsGetSystemAdminCount provides a mock function with given fields: +func (_m *UserStore) AnalyticsGetSystemAdminCount() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// AnalyticsUniqueUserCount provides a mock function with given fields: teamId +func (_m *UserStore) AnalyticsUniqueUserCount(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Get provides a mock function with given fields: id +func (_m *UserStore) Get(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAll provides a mock function with given fields: +func (_m *UserStore) GetAll() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllProfiles provides a mock function with given fields: offset, limit +func (_m *UserStore) GetAllProfiles(offset int, limit int) store.StoreChannel { + ret := _m.Called(offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int, int) store.StoreChannel); ok { + r0 = rf(offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllProfilesInChannel provides a mock function with given fields: channelId, allowFromCache +func (_m *UserStore) GetAllProfilesInChannel(channelId string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(channelId, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool) store.StoreChannel); ok { + r0 = rf(channelId, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetAllUsingAuthService provides a mock function with given fields: authService +func (_m *UserStore) GetAllUsingAuthService(authService string) store.StoreChannel { + ret := _m.Called(authService) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(authService) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByAuth provides a mock function with given fields: authData, authService +func (_m *UserStore) GetByAuth(authData *string, authService string) store.StoreChannel { + ret := _m.Called(authData, authService) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*string, string) store.StoreChannel); ok { + r0 = rf(authData, authService) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByEmail provides a mock function with given fields: email +func (_m *UserStore) GetByEmail(email string) store.StoreChannel { + ret := _m.Called(email) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(email) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetByUsername provides a mock function with given fields: username +func (_m *UserStore) GetByUsername(username string) store.StoreChannel { + ret := _m.Called(username) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(username) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetEtagForAllProfiles provides a mock function with given fields: +func (_m *UserStore) GetEtagForAllProfiles() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetEtagForProfiles provides a mock function with given fields: teamId +func (_m *UserStore) GetEtagForProfiles(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetEtagForProfilesNotInTeam provides a mock function with given fields: teamId +func (_m *UserStore) GetEtagForProfilesNotInTeam(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetForLogin provides a mock function with given fields: loginId, allowSignInWithUsername, allowSignInWithEmail, ldapEnabled +func (_m *UserStore) GetForLogin(loginId string, allowSignInWithUsername bool, allowSignInWithEmail bool, ldapEnabled bool) store.StoreChannel { + ret := _m.Called(loginId, allowSignInWithUsername, allowSignInWithEmail, ldapEnabled) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool, bool, bool) store.StoreChannel); ok { + r0 = rf(loginId, allowSignInWithUsername, allowSignInWithEmail, ldapEnabled) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetNewUsersForTeam provides a mock function with given fields: teamId, offset, limit +func (_m *UserStore) GetNewUsersForTeam(teamId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(teamId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(teamId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetProfileByIds provides a mock function with given fields: userId, allowFromCache +func (_m *UserStore) GetProfileByIds(userId []string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(userId, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func([]string, bool) store.StoreChannel); ok { + r0 = rf(userId, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetProfiles provides a mock function with given fields: teamId, offset, limit +func (_m *UserStore) GetProfiles(teamId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(teamId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(teamId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetProfilesByUsernames provides a mock function with given fields: usernames, teamId +func (_m *UserStore) GetProfilesByUsernames(usernames []string, teamId string) store.StoreChannel { + ret := _m.Called(usernames, teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func([]string, string) store.StoreChannel); ok { + r0 = rf(usernames, teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetProfilesInChannel provides a mock function with given fields: channelId, offset, limit +func (_m *UserStore) GetProfilesInChannel(channelId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(channelId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(channelId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetProfilesNotInChannel provides a mock function with given fields: teamId, channelId, offset, limit +func (_m *UserStore) GetProfilesNotInChannel(teamId string, channelId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(teamId, channelId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, int, int) store.StoreChannel); ok { + r0 = rf(teamId, channelId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetProfilesNotInTeam provides a mock function with given fields: teamId, offset, limit +func (_m *UserStore) GetProfilesNotInTeam(teamId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(teamId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(teamId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetProfilesWithoutTeam provides a mock function with given fields: offset, limit +func (_m *UserStore) GetProfilesWithoutTeam(offset int, limit int) store.StoreChannel { + ret := _m.Called(offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int, int) store.StoreChannel); ok { + r0 = rf(offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetRecentlyActiveUsersForTeam provides a mock function with given fields: teamId, offset, limit +func (_m *UserStore) GetRecentlyActiveUsersForTeam(teamId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(teamId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(teamId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetSystemAdminProfiles provides a mock function with given fields: +func (_m *UserStore) GetSystemAdminProfiles() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetTotalUsersCount provides a mock function with given fields: +func (_m *UserStore) GetTotalUsersCount() store.StoreChannel { + ret := _m.Called() + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func() store.StoreChannel); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetUnreadCount provides a mock function with given fields: userId +func (_m *UserStore) GetUnreadCount(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetUnreadCountForChannel provides a mock function with given fields: userId, channelId +func (_m *UserStore) GetUnreadCountForChannel(userId string, channelId string) store.StoreChannel { + ret := _m.Called(userId, channelId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(userId, channelId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// InvalidatProfileCacheForUser provides a mock function with given fields: userId +func (_m *UserStore) InvalidatProfileCacheForUser(userId string) { + _m.Called(userId) +} + +// InvalidateProfilesInChannelCache provides a mock function with given fields: channelId +func (_m *UserStore) InvalidateProfilesInChannelCache(channelId string) { + _m.Called(channelId) +} + +// InvalidateProfilesInChannelCacheByUser provides a mock function with given fields: userId +func (_m *UserStore) InvalidateProfilesInChannelCacheByUser(userId string) { + _m.Called(userId) +} + +// PermanentDelete provides a mock function with given fields: userId +func (_m *UserStore) PermanentDelete(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Save provides a mock function with given fields: user +func (_m *UserStore) Save(user *model.User) store.StoreChannel { + ret := _m.Called(user) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.User) store.StoreChannel); ok { + r0 = rf(user) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Search provides a mock function with given fields: teamId, term, options +func (_m *UserStore) Search(teamId string, term string, options map[string]bool) store.StoreChannel { + ret := _m.Called(teamId, term, options) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, map[string]bool) store.StoreChannel); ok { + r0 = rf(teamId, term, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SearchInChannel provides a mock function with given fields: channelId, term, options +func (_m *UserStore) SearchInChannel(channelId string, term string, options map[string]bool) store.StoreChannel { + ret := _m.Called(channelId, term, options) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, map[string]bool) store.StoreChannel); ok { + r0 = rf(channelId, term, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SearchNotInChannel provides a mock function with given fields: teamId, channelId, term, options +func (_m *UserStore) SearchNotInChannel(teamId string, channelId string, term string, options map[string]bool) store.StoreChannel { + ret := _m.Called(teamId, channelId, term, options) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, string, map[string]bool) store.StoreChannel); ok { + r0 = rf(teamId, channelId, term, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SearchNotInTeam provides a mock function with given fields: notInTeamId, term, options +func (_m *UserStore) SearchNotInTeam(notInTeamId string, term string, options map[string]bool) store.StoreChannel { + ret := _m.Called(notInTeamId, term, options) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, map[string]bool) store.StoreChannel); ok { + r0 = rf(notInTeamId, term, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SearchWithoutTeam provides a mock function with given fields: term, options +func (_m *UserStore) SearchWithoutTeam(term string, options map[string]bool) store.StoreChannel { + ret := _m.Called(term, options) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, map[string]bool) store.StoreChannel); ok { + r0 = rf(term, options) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// Update provides a mock function with given fields: user, allowRoleUpdate +func (_m *UserStore) Update(user *model.User, allowRoleUpdate bool) store.StoreChannel { + ret := _m.Called(user, allowRoleUpdate) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.User, bool) store.StoreChannel); ok { + r0 = rf(user, allowRoleUpdate) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateAuthData provides a mock function with given fields: userId, service, authData, email, resetMfa +func (_m *UserStore) UpdateAuthData(userId string, service string, authData *string, email string, resetMfa bool) store.StoreChannel { + ret := _m.Called(userId, service, authData, email, resetMfa) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string, *string, string, bool) store.StoreChannel); ok { + r0 = rf(userId, service, authData, email, resetMfa) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateFailedPasswordAttempts provides a mock function with given fields: userId, attempts +func (_m *UserStore) UpdateFailedPasswordAttempts(userId string, attempts int) store.StoreChannel { + ret := _m.Called(userId, attempts) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int) store.StoreChannel); ok { + r0 = rf(userId, attempts) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateLastPictureUpdate provides a mock function with given fields: userId +func (_m *UserStore) UpdateLastPictureUpdate(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateMfaActive provides a mock function with given fields: userId, active +func (_m *UserStore) UpdateMfaActive(userId string, active bool) store.StoreChannel { + ret := _m.Called(userId, active) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool) store.StoreChannel); ok { + r0 = rf(userId, active) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateMfaSecret provides a mock function with given fields: userId, secret +func (_m *UserStore) UpdateMfaSecret(userId string, secret string) store.StoreChannel { + ret := _m.Called(userId, secret) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(userId, secret) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdatePassword provides a mock function with given fields: userId, newPassword +func (_m *UserStore) UpdatePassword(userId string, newPassword string) store.StoreChannel { + ret := _m.Called(userId, newPassword) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, string) store.StoreChannel); ok { + r0 = rf(userId, newPassword) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateUpdateAt provides a mock function with given fields: userId +func (_m *UserStore) UpdateUpdateAt(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// VerifyEmail provides a mock function with given fields: userId +func (_m *UserStore) VerifyEmail(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/mocks/WebhookStore.go b/store/storetest/mocks/WebhookStore.go new file mode 100644 index 000000000..aa66e0600 --- /dev/null +++ b/store/storetest/mocks/WebhookStore.go @@ -0,0 +1,339 @@ +// Code generated by mockery v1.0.0 + +// Regenerate this file using `make store-mocks`. + +package mocks + +import mock "github.com/stretchr/testify/mock" +import model "github.com/mattermost/mattermost-server/model" +import store "github.com/mattermost/mattermost-server/store" + +// WebhookStore is an autogenerated mock type for the WebhookStore type +type WebhookStore struct { + mock.Mock +} + +// AnalyticsIncomingCount provides a mock function with given fields: teamId +func (_m *WebhookStore) AnalyticsIncomingCount(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// AnalyticsOutgoingCount provides a mock function with given fields: teamId +func (_m *WebhookStore) AnalyticsOutgoingCount(teamId string) store.StoreChannel { + ret := _m.Called(teamId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(teamId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// DeleteIncoming provides a mock function with given fields: webhookId, time +func (_m *WebhookStore) DeleteIncoming(webhookId string, time int64) store.StoreChannel { + ret := _m.Called(webhookId, time) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64) store.StoreChannel); ok { + r0 = rf(webhookId, time) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// DeleteOutgoing provides a mock function with given fields: webhookId, time +func (_m *WebhookStore) DeleteOutgoing(webhookId string, time int64) store.StoreChannel { + ret := _m.Called(webhookId, time) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int64) store.StoreChannel); ok { + r0 = rf(webhookId, time) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetIncoming provides a mock function with given fields: id, allowFromCache +func (_m *WebhookStore) GetIncoming(id string, allowFromCache bool) store.StoreChannel { + ret := _m.Called(id, allowFromCache) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, bool) store.StoreChannel); ok { + r0 = rf(id, allowFromCache) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetIncomingByChannel provides a mock function with given fields: channelId +func (_m *WebhookStore) GetIncomingByChannel(channelId string) store.StoreChannel { + ret := _m.Called(channelId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(channelId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetIncomingByTeam provides a mock function with given fields: teamId, offset, limit +func (_m *WebhookStore) GetIncomingByTeam(teamId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(teamId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(teamId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetIncomingList provides a mock function with given fields: offset, limit +func (_m *WebhookStore) GetIncomingList(offset int, limit int) store.StoreChannel { + ret := _m.Called(offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int, int) store.StoreChannel); ok { + r0 = rf(offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetOutgoing provides a mock function with given fields: id +func (_m *WebhookStore) GetOutgoing(id string) store.StoreChannel { + ret := _m.Called(id) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetOutgoingByChannel provides a mock function with given fields: channelId, offset, limit +func (_m *WebhookStore) GetOutgoingByChannel(channelId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(channelId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(channelId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetOutgoingByTeam provides a mock function with given fields: teamId, offset, limit +func (_m *WebhookStore) GetOutgoingByTeam(teamId string, offset int, limit int) store.StoreChannel { + ret := _m.Called(teamId, offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string, int, int) store.StoreChannel); ok { + r0 = rf(teamId, offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// GetOutgoingList provides a mock function with given fields: offset, limit +func (_m *WebhookStore) GetOutgoingList(offset int, limit int) store.StoreChannel { + ret := _m.Called(offset, limit) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(int, int) store.StoreChannel); ok { + r0 = rf(offset, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// InvalidateWebhookCache provides a mock function with given fields: webhook +func (_m *WebhookStore) InvalidateWebhookCache(webhook string) { + _m.Called(webhook) +} + +// PermanentDeleteIncomingByChannel provides a mock function with given fields: channelId +func (_m *WebhookStore) PermanentDeleteIncomingByChannel(channelId string) store.StoreChannel { + ret := _m.Called(channelId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(channelId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteIncomingByUser provides a mock function with given fields: userId +func (_m *WebhookStore) PermanentDeleteIncomingByUser(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteOutgoingByChannel provides a mock function with given fields: channelId +func (_m *WebhookStore) PermanentDeleteOutgoingByChannel(channelId string) store.StoreChannel { + ret := _m.Called(channelId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(channelId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// PermanentDeleteOutgoingByUser provides a mock function with given fields: userId +func (_m *WebhookStore) PermanentDeleteOutgoingByUser(userId string) store.StoreChannel { + ret := _m.Called(userId) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(string) store.StoreChannel); ok { + r0 = rf(userId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SaveIncoming provides a mock function with given fields: webhook +func (_m *WebhookStore) SaveIncoming(webhook *model.IncomingWebhook) store.StoreChannel { + ret := _m.Called(webhook) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.IncomingWebhook) store.StoreChannel); ok { + r0 = rf(webhook) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// SaveOutgoing provides a mock function with given fields: webhook +func (_m *WebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) store.StoreChannel { + ret := _m.Called(webhook) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.OutgoingWebhook) store.StoreChannel); ok { + r0 = rf(webhook) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateIncoming provides a mock function with given fields: webhook +func (_m *WebhookStore) UpdateIncoming(webhook *model.IncomingWebhook) store.StoreChannel { + ret := _m.Called(webhook) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.IncomingWebhook) store.StoreChannel); ok { + r0 = rf(webhook) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} + +// UpdateOutgoing provides a mock function with given fields: hook +func (_m *WebhookStore) UpdateOutgoing(hook *model.OutgoingWebhook) store.StoreChannel { + ret := _m.Called(hook) + + var r0 store.StoreChannel + if rf, ok := ret.Get(0).(func(*model.OutgoingWebhook) store.StoreChannel); ok { + r0 = rf(hook) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(store.StoreChannel) + } + } + + return r0 +} diff --git a/store/storetest/store.go b/store/storetest/store.go new file mode 100644 index 000000000..7201df6ec --- /dev/null +++ b/store/storetest/store.go @@ -0,0 +1,100 @@ +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +package storetest + +import ( + "github.com/stretchr/testify/mock" + + "github.com/mattermost/mattermost-server/store" + "github.com/mattermost/mattermost-server/store/storetest/mocks" +) + +// NewStoreChannel returns a channel that will receive the given result. +func NewStoreChannel(result store.StoreResult) store.StoreChannel { + ch := make(store.StoreChannel, 1) + ch <- result + return ch +} + +// Store can be used to provide mock stores for testing. +type Store struct { + TeamStore mocks.TeamStore + ChannelStore mocks.ChannelStore + PostStore mocks.PostStore + UserStore mocks.UserStore + AuditStore mocks.AuditStore + ClusterDiscoveryStore mocks.ClusterDiscoveryStore + ComplianceStore mocks.ComplianceStore + SessionStore mocks.SessionStore + OAuthStore mocks.OAuthStore + SystemStore mocks.SystemStore + WebhookStore mocks.WebhookStore + CommandStore mocks.CommandStore + CommandWebhookStore mocks.CommandWebhookStore + PreferenceStore mocks.PreferenceStore + LicenseStore mocks.LicenseStore + TokenStore mocks.TokenStore + EmojiStore mocks.EmojiStore + StatusStore mocks.StatusStore + FileInfoStore mocks.FileInfoStore + ReactionStore mocks.ReactionStore + JobStore mocks.JobStore + UserAccessTokenStore mocks.UserAccessTokenStore +} + +func (s *Store) Team() store.TeamStore { return &s.TeamStore } +func (s *Store) Channel() store.ChannelStore { return &s.ChannelStore } +func (s *Store) Post() store.PostStore { return &s.PostStore } +func (s *Store) User() store.UserStore { return &s.UserStore } +func (s *Store) Audit() store.AuditStore { return &s.AuditStore } +func (s *Store) ClusterDiscovery() store.ClusterDiscoveryStore { return &s.ClusterDiscoveryStore } +func (s *Store) Compliance() store.ComplianceStore { return &s.ComplianceStore } +func (s *Store) Session() store.SessionStore { return &s.SessionStore } +func (s *Store) OAuth() store.OAuthStore { return &s.OAuthStore } +func (s *Store) System() store.SystemStore { return &s.SystemStore } +func (s *Store) Webhook() store.WebhookStore { return &s.WebhookStore } +func (s *Store) Command() store.CommandStore { return &s.CommandStore } +func (s *Store) CommandWebhook() store.CommandWebhookStore { return &s.CommandWebhookStore } +func (s *Store) Preference() store.PreferenceStore { return &s.PreferenceStore } +func (s *Store) License() store.LicenseStore { return &s.LicenseStore } +func (s *Store) Token() store.TokenStore { return &s.TokenStore } +func (s *Store) Emoji() store.EmojiStore { return &s.EmojiStore } +func (s *Store) Status() store.StatusStore { return &s.StatusStore } +func (s *Store) FileInfo() store.FileInfoStore { return &s.FileInfoStore } +func (s *Store) Reaction() store.ReactionStore { return &s.ReactionStore } +func (s *Store) Job() store.JobStore { return &s.JobStore } +func (s *Store) UserAccessToken() store.UserAccessTokenStore { return &s.UserAccessTokenStore } +func (s *Store) MarkSystemRanUnitTests() { /* do nothing */ } +func (s *Store) Close() { /* do nothing */ } +func (s *Store) DropAllTables() { /* do nothing */ } +func (s *Store) TotalMasterDbConnections() int { return 1 } +func (s *Store) TotalReadDbConnections() int { return 1 } +func (s *Store) TotalSearchDbConnections() int { return 1 } + +func (s *Store) AssertExpectations(t mock.TestingT) bool { + return mock.AssertExpectationsForObjects(t, + &s.TeamStore, + &s.ChannelStore, + &s.PostStore, + &s.UserStore, + &s.AuditStore, + &s.ClusterDiscoveryStore, + &s.ComplianceStore, + &s.SessionStore, + &s.OAuthStore, + &s.SystemStore, + &s.WebhookStore, + &s.CommandStore, + &s.CommandWebhookStore, + &s.PreferenceStore, + &s.LicenseStore, + &s.TokenStore, + &s.EmojiStore, + &s.StatusStore, + &s.FileInfoStore, + &s.ReactionStore, + &s.JobStore, + &s.UserAccessTokenStore, + ) +} -- cgit v1.2.3-1-g7c22