* Finished

* Fiximports

* Fix i18n
Этот коммит содержится в:
Rodrigo Villablanca
2020-07-15 09:26:28 -04:00
коммит произвёл GitHub
родитель b15c0484c6
Коммит 87dfbc13c0
16 изменённых файлов: 259 добавлений и 277 удалений

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

@@ -15,7 +15,7 @@ type SessionStore struct {
}
// AnalyticsSessionCount provides a mock function with given fields:
func (_m *SessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
func (_m *SessionStore) AnalyticsSessionCount() (int64, error) {
ret := _m.Called()
var r0 int64
@@ -25,13 +25,11 @@ func (_m *SessionStore) AnalyticsSessionCount() (int64, *model.AppError) {
r0 = ret.Get(0).(int64)
}
var r1 *model.AppError
if rf, ok := ret.Get(1).(func() *model.AppError); ok {
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
r1 = ret.Error(1)
}
return r0, r1
@@ -43,7 +41,7 @@ func (_m *SessionStore) Cleanup(expiryTime int64, batchSize int64) {
}
// Get provides a mock function with given fields: sessionIdOrToken
func (_m *SessionStore) Get(sessionIdOrToken string) (*model.Session, *model.AppError) {
func (_m *SessionStore) Get(sessionIdOrToken string) (*model.Session, error) {
ret := _m.Called(sessionIdOrToken)
var r0 *model.Session
@@ -55,20 +53,18 @@ func (_m *SessionStore) Get(sessionIdOrToken string) (*model.Session, *model.App
}
}
var r1 *model.AppError
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(sessionIdOrToken)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
r1 = ret.Error(1)
}
return r0, r1
}
// GetSessions provides a mock function with given fields: userId
func (_m *SessionStore) GetSessions(userId string) ([]*model.Session, *model.AppError) {
func (_m *SessionStore) GetSessions(userId string) ([]*model.Session, error) {
ret := _m.Called(userId)
var r0 []*model.Session
@@ -80,20 +76,18 @@ func (_m *SessionStore) GetSessions(userId string) ([]*model.Session, *model.App
}
}
var r1 *model.AppError
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userId)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
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, *model.AppError) {
func (_m *SessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error) {
ret := _m.Called(thresholdMillis, mobileOnly, unnotifiedOnly)
var r0 []*model.Session
@@ -105,20 +99,18 @@ func (_m *SessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly boo
}
}
var r1 *model.AppError
if rf, ok := ret.Get(1).(func(int64, bool, bool) *model.AppError); ok {
var r1 error
if rf, ok := ret.Get(1).(func(int64, bool, bool) error); ok {
r1 = rf(thresholdMillis, mobileOnly, unnotifiedOnly)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
r1 = ret.Error(1)
}
return r0, r1
}
// GetSessionsWithActiveDeviceIds provides a mock function with given fields: userId
func (_m *SessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, *model.AppError) {
func (_m *SessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, error) {
ret := _m.Called(userId)
var r0 []*model.Session
@@ -130,68 +122,60 @@ func (_m *SessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.
}
}
var r1 *model.AppError
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
var r1 error
if rf, ok := ret.Get(1).(func(string) error); ok {
r1 = rf(userId)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
r1 = ret.Error(1)
}
return r0, r1
}
// PermanentDeleteSessionsByUser provides a mock function with given fields: teamId
func (_m *SessionStore) PermanentDeleteSessionsByUser(teamId string) *model.AppError {
func (_m *SessionStore) PermanentDeleteSessionsByUser(teamId string) error {
ret := _m.Called(teamId)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(teamId)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
r0 = ret.Error(0)
}
return r0
}
// Remove provides a mock function with given fields: sessionIdOrToken
func (_m *SessionStore) Remove(sessionIdOrToken string) *model.AppError {
func (_m *SessionStore) Remove(sessionIdOrToken string) error {
ret := _m.Called(sessionIdOrToken)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string) *model.AppError); ok {
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(sessionIdOrToken)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
r0 = ret.Error(0)
}
return r0
}
// RemoveAllSessions provides a mock function with given fields:
func (_m *SessionStore) RemoveAllSessions() *model.AppError {
func (_m *SessionStore) RemoveAllSessions() error {
ret := _m.Called()
var r0 *model.AppError
if rf, ok := ret.Get(0).(func() *model.AppError); ok {
var r0 error
if rf, ok := ret.Get(0).(func() error); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
r0 = ret.Error(0)
}
return r0
}
// Save provides a mock function with given fields: session
func (_m *SessionStore) Save(session *model.Session) (*model.Session, *model.AppError) {
func (_m *SessionStore) Save(session *model.Session) (*model.Session, error) {
ret := _m.Called(session)
var r0 *model.Session
@@ -203,20 +187,18 @@ func (_m *SessionStore) Save(session *model.Session) (*model.Session, *model.App
}
}
var r1 *model.AppError
if rf, ok := ret.Get(1).(func(*model.Session) *model.AppError); ok {
var r1 error
if rf, ok := ret.Get(1).(func(*model.Session) error); ok {
r1 = rf(session)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
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, *model.AppError) {
func (_m *SessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, error) {
ret := _m.Called(id, deviceId, expiresAt)
var r0 string
@@ -226,84 +208,74 @@ func (_m *SessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int
r0 = ret.Get(0).(string)
}
var r1 *model.AppError
if rf, ok := ret.Get(1).(func(string, string, int64) *model.AppError); ok {
var r1 error
if rf, ok := ret.Get(1).(func(string, string, int64) error); ok {
r1 = rf(id, deviceId, expiresAt)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
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) *model.AppError {
func (_m *SessionStore) UpdateExpiredNotify(sessionid string, notified bool) error {
ret := _m.Called(sessionid, notified)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, bool) *model.AppError); ok {
var r0 error
if rf, ok := ret.Get(0).(func(string, bool) error); ok {
r0 = rf(sessionid, notified)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
r0 = ret.Error(0)
}
return r0
}
// UpdateExpiresAt provides a mock function with given fields: sessionId, time
func (_m *SessionStore) UpdateExpiresAt(sessionId string, time int64) *model.AppError {
func (_m *SessionStore) UpdateExpiresAt(sessionId string, time int64) error {
ret := _m.Called(sessionId, time)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, int64) *model.AppError); ok {
var r0 error
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
r0 = rf(sessionId, time)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
r0 = ret.Error(0)
}
return r0
}
// UpdateLastActivityAt provides a mock function with given fields: sessionId, time
func (_m *SessionStore) UpdateLastActivityAt(sessionId string, time int64) *model.AppError {
func (_m *SessionStore) UpdateLastActivityAt(sessionId string, time int64) error {
ret := _m.Called(sessionId, time)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(string, int64) *model.AppError); ok {
var r0 error
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
r0 = rf(sessionId, time)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
r0 = ret.Error(0)
}
return r0
}
// UpdateProps provides a mock function with given fields: session
func (_m *SessionStore) UpdateProps(session *model.Session) *model.AppError {
func (_m *SessionStore) UpdateProps(session *model.Session) error {
ret := _m.Called(session)
var r0 *model.AppError
if rf, ok := ret.Get(0).(func(*model.Session) *model.AppError); ok {
var r0 error
if rf, ok := ret.Get(0).(func(*model.Session) error); ok {
r0 = rf(session)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.AppError)
}
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, *model.AppError) {
func (_m *SessionStore) UpdateRoles(userId string, roles string) (string, error) {
ret := _m.Called(userId, roles)
var r0 string
@@ -313,13 +285,11 @@ func (_m *SessionStore) UpdateRoles(userId string, roles string) (string, *model
r0 = ret.Get(0).(string)
}
var r1 *model.AppError
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
var r1 error
if rf, ok := ret.Get(1).(func(string, string) error); ok {
r1 = rf(userId, roles)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
r1 = ret.Error(1)
}
return r0, r1

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

@@ -366,8 +366,8 @@ func testOAuthStoreDeleteApp(t *testing.T, ss store.Store) {
s1.Token = model.NewId()
s1.IsOAuth = true
s1, err = ss.Session().Save(s1)
require.Nil(t, err)
s1, nErr := ss.Session().Save(s1)
require.Nil(t, nErr)
ad1 := model.AccessData{}
ad1.ClientId = a1.Id
@@ -382,8 +382,8 @@ func testOAuthStoreDeleteApp(t *testing.T, ss store.Store) {
err = ss.OAuth().DeleteApp(a1.Id)
require.Nil(t, err)
_, err = ss.Session().Get(s1.Token)
require.NotNil(t, err, "should error - session should be deleted")
_, nErr = ss.Session().Get(s1.Token)
require.NotNil(t, nErr, "should error - session should be deleted")
_, err = ss.OAuth().GetAccessData(s1.Token)
require.NotNil(t, err, "should error - access data should be deleted")

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

@@ -381,12 +381,14 @@ func testUpdateExpiredNotify(t *testing.T, ss store.Store) {
require.Nil(t, err)
require.False(t, session.ExpiredNotify)
ss.Session().UpdateExpiredNotify(session.Id, true)
err = ss.Session().UpdateExpiredNotify(session.Id, true)
require.Nil(t, err)
session, err = ss.Session().Get(s1.Id)
require.Nil(t, err)
require.True(t, session.ExpiredNotify)
ss.Session().UpdateExpiredNotify(session.Id, false)
err = ss.Session().UpdateExpiredNotify(session.Id, false)
require.Nil(t, err)
session, err = ss.Session().Get(s1.Id)
require.Nil(t, err)
require.False(t, session.ExpiredNotify)

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

@@ -134,8 +134,8 @@ func testUserAccessTokenSearch(t *testing.T, ss store.Store) {
s1.UserId = uat.UserId
s1.Token = uat.Token
s1, err = ss.Session().Save(s1)
require.Nil(t, err)
s1, nErr := ss.Session().Save(s1)
require.Nil(t, nErr)
_, err = ss.UserAccessToken().Save(uat)
require.Nil(t, err)