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 --- store/storetest/mocks/UserStore.go | 749 +++++++++++++++++++++++++++++++++++++ 1 file changed, 749 insertions(+) create mode 100644 store/storetest/mocks/UserStore.go (limited to 'store/storetest/mocks/UserStore.go') 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 +} -- cgit v1.2.3-1-g7c22