Files
mostlymatter/store/storetest/mocks/SessionStore.go
Martin Raymond Kraft 58dce5930e [MM-31094] Replication Lag (#16888)
* MM-31094: Adds tooling to develop and test using a MySQL instance with replication lag. Adds some lazy lookups to fallback to master if results are not found.

* MM-31094: Removes mysql-read-replica from default docker services.

* MM-31094: Switches (store..SessionStore).Get and (store.TeamStore).GetMember to using context.Context.

* MM-31094: Updates (store.UsersStore).Get to use context.

* MM-31094: Updates (store.PostStore).Get to use context.

* MM-31094: Removes feature flag and config setting.

* MM-31094: Rolls back some master reads.

* MM-31094: Rolls a non-cache read.

* MM-31094: Removes feature flag from the store.

* MM-31094: Removes unused constant and struct field.

* MM-31094: Removes some old feature flag references.

* MM-31094: Fixes some tests.

* MM-31094: App layers fix.

* MM-31094: Fixes mocks.

* MM-31094: Don't reparse flag.

* MM-31094: No reparse.

* MM-31094: Removed unused FeatureFlags field.

* MM-31094: Removes unnecessary feature flags variable declarations.

* MM-31094: Fixes copy-paste error.

* MM-31094: Fixes logical error.

* MM-30194: Removes test method from store.

* Revert "MM-30194: Removes test method from store."

This reverts commit d5a6e8529bd5f4d993824c828e239d009b05e567.

* MM-31094: Conforming to make's strange syntax.

* MM-31094: Configures helper for read replica with option.

* MM-31094: Adds some missing ctx's.

* MM-31094: WIP

* MM-31094: Updates test names.

* MM-31094: WIP

* MM-31094: Removes unnecessary master reads.

* MM-31094: ID case changes out of scope.

* MM-31094: Removes unused context.

* MM-31094: Switches to a helper. Removes some var naming changes. Fixes a merge error.

* MM-31094: Removes SQLITE db driver ref.

* MM-31094: Layer generate fix.

* MM-31094: Removes unnecessary changes.

* MM-31094: Moves test method.

* MM-31094: Re-add previous fix.

* MM-31094: Removes make command for dev.

* MM-31094: Fix for login.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-03-12 12:37:30 -05:00

299 строки
6.9 KiB
Go

// Code generated by mockery v1.0.0. DO NOT EDIT.
// Regenerate this file using `make store-mocks`.
package mocks
import (
context "context"
model "github.com/mattermost/mattermost-server/v5/model"
mock "github.com/stretchr/testify/mock"
)
// 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() (int64, error) {
ret := _m.Called()
var r0 int64
if rf, ok := ret.Get(0).(func() int64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(int64)
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Cleanup provides a mock function with given fields: expiryTime, batchSize
func (_m *SessionStore) Cleanup(expiryTime int64, batchSize int64) {
_m.Called(expiryTime, batchSize)
}
// Get provides a mock function with given fields: ctx, sessionIDOrToken
func (_m *SessionStore) Get(ctx context.Context, sessionIDOrToken string) (*model.Session, error) {
ret := _m.Called(ctx, sessionIDOrToken)
var r0 *model.Session
if rf, ok := ret.Get(0).(func(context.Context, string) *model.Session); ok {
r0 = rf(ctx, sessionIDOrToken)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Session)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(ctx, sessionIDOrToken)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetSessions provides a mock function with given fields: userId
func (_m *SessionStore) GetSessions(userId string) ([]*model.Session, error) {
ret := _m.Called(userId)
var r0 []*model.Session
if rf, ok := ret.Get(0).(func(string) []*model.Session); ok {
r0 = rf(userId)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Session)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetSessionsExpired provides a mock function with given fields: thresholdMillis, mobileOnly, unnotifiedOnly
func (_m *SessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error) {
ret := _m.Called(thresholdMillis, mobileOnly, unnotifiedOnly)
var r0 []*model.Session
if rf, ok := ret.Get(0).(func(int64, bool, bool) []*model.Session); ok {
r0 = rf(thresholdMillis, mobileOnly, unnotifiedOnly)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Session)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(int64, bool, bool) error); ok {
r1 = rf(thresholdMillis, mobileOnly, unnotifiedOnly)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetSessionsWithActiveDeviceIds provides a mock function with given fields: userId
func (_m *SessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, error) {
ret := _m.Called(userId)
var r0 []*model.Session
if rf, ok := ret.Get(0).(func(string) []*model.Session); ok {
r0 = rf(userId)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Session)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userId)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// PermanentDeleteSessionsByUser provides a mock function with given fields: teamID
func (_m *SessionStore) PermanentDeleteSessionsByUser(teamID string) error {
ret := _m.Called(teamID)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(teamID)
} else {
r0 = ret.Error(0)
}
return r0
}
// Remove provides a mock function with given fields: sessionIDOrToken
func (_m *SessionStore) Remove(sessionIDOrToken string) error {
ret := _m.Called(sessionIDOrToken)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(sessionIDOrToken)
} else {
r0 = ret.Error(0)
}
return r0
}
// RemoveAllSessions provides a mock function with given fields:
func (_m *SessionStore) RemoveAllSessions() error {
ret := _m.Called()
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
r0 = ret.Error(0)
}
return r0
}
// Save provides a mock function with given fields: session
func (_m *SessionStore) Save(session *model.Session) (*model.Session, error) {
ret := _m.Called(session)
var r0 *model.Session
if rf, ok := ret.Get(0).(func(*model.Session) *model.Session); ok {
r0 = rf(session)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Session)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(*model.Session) error); ok {
r1 = rf(session)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateDeviceId provides a mock function with given fields: id, deviceID, expiresAt
func (_m *SessionStore) UpdateDeviceId(id string, deviceID string, expiresAt int64) (string, error) {
ret := _m.Called(id, deviceID, expiresAt)
var r0 string
if rf, ok := ret.Get(0).(func(string, string, int64) string); ok {
r0 = rf(id, deviceID, expiresAt)
} else {
r0 = ret.Get(0).(string)
}
var r1 error
if rf, ok := ret.Get(1).(func(string, string, int64) error); ok {
r1 = rf(id, deviceID, expiresAt)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateExpiredNotify provides a mock function with given fields: sessionid, notified
func (_m *SessionStore) UpdateExpiredNotify(sessionid string, notified bool) error {
ret := _m.Called(sessionid, notified)
var r0 error
if rf, ok := ret.Get(0).(func(string, bool) error); ok {
r0 = rf(sessionid, notified)
} else {
r0 = ret.Error(0)
}
return r0
}
// UpdateExpiresAt provides a mock function with given fields: sessionID, time
func (_m *SessionStore) UpdateExpiresAt(sessionID string, time int64) error {
ret := _m.Called(sessionID, time)
var r0 error
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
r0 = rf(sessionID, time)
} else {
r0 = ret.Error(0)
}
return r0
}
// UpdateLastActivityAt provides a mock function with given fields: sessionID, time
func (_m *SessionStore) UpdateLastActivityAt(sessionID string, time int64) error {
ret := _m.Called(sessionID, time)
var r0 error
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
r0 = rf(sessionID, time)
} else {
r0 = ret.Error(0)
}
return r0
}
// UpdateProps provides a mock function with given fields: session
func (_m *SessionStore) UpdateProps(session *model.Session) error {
ret := _m.Called(session)
var r0 error
if rf, ok := ret.Get(0).(func(*model.Session) error); ok {
r0 = rf(session)
} else {
r0 = ret.Error(0)
}
return r0
}
// UpdateRoles provides a mock function with given fields: userId, roles
func (_m *SessionStore) UpdateRoles(userId string, roles string) (string, error) {
ret := _m.Called(userId, roles)
var r0 string
if rf, ok := ret.Get(0).(func(string, string) string); ok {
r0 = rf(userId, roles)
} else {
r0 = ret.Get(0).(string)
}
var r1 error
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(userId, roles)
} else {
r1 = ret.Error(1)
}
return r0, r1
}