Some checks failed
Server CI / Postgres (shard 0) (push) Has been skipped
Server CI / Postgres (shard 3) (push) Has been skipped
BuildEnv Docker Image / build-image (push) Failing after 4s
BuildEnv Docker Image / build-image-fips (push) Failing after 4s
Migration Review & Release Notes / Generate migration review & release notes (push) Failing after 3s
Server CI / Build Environment (push) Failing after 3s
Server CI / Postgres (shard 1) (push) Has been skipped
Tools CI / check-style (mattermost-govet) (push) Failing after 4s
Server CI / Postgres (shard 2) (push) Has been skipped
Tools CI / check-style (mmgotool) (push) Failing after 3s
Server CI / Elasticsearch v8 Compatibility (push) Has been skipped
Server CI / OpenSearch v2 Compatibility (push) Has been skipped
Server CI / Postgres FIPS (shard 0) (push) Has been skipped
Tools CI / Test (mattermost-govet) (push) Failing after 3s
Server CI / Postgres FIPS (shard 1) (push) Has been skipped
Server CI / Postgres FIPS (shard 2) (push) Has been skipped
Tools CI / Test (mmgotool) (push) Failing after 3s
Server CI / Postgres FIPS (shard 3) (push) Has been skipped
Server CI / Run mmctl tests (push) Has been skipped
Server CI / Run mmctl tests (FIPS) (push) Has been skipped
Server CI / Merge Postgres Test Results (push) Has been skipped
Server CI / Merge Postgres FIPS Test Results (push) Has been skipped
Server CI / Check backport migrations (push) Has been skipped
Server CI / Check generated files (push) Has been skipped
Server CI / check-style (push) Has been skipped
Server CI / Vet API (push) Has been skipped
Server CI / Build mattermost server app (push) Has been skipped
Server CI / Server CI Complete (push) Failing after 2s
Server CI / Server CI Artifacts (push) Has been skipped
Server CI / Sentry Upload (push) Has been skipped
Server CI / Server CI Report (push) Failing after 5m1s
Server CI Nightly Race / Race Detector (push) Has been skipped
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
Webapp CI Cache Warm / Warm Webapp node_modules Cache (push) Has been cancelled
E2E CI Cache Warm / Warm E2E npm Registry Cache (push) Has been cancelled
API / build (push) Has been cancelled
Web App CI / check-types (push) Has been cancelled
Web App CI / check-lint (push) Has been cancelled
Web App CI / check-i18n (push) Has been cancelled
Web App CI / check-external-links (push) Has been cancelled
Web App CI / test (platform) (push) Has been cancelled
Web App CI / test (mattermost-redux) (push) Has been cancelled
Web App CI / test (channels shard 1/4) (push) Has been cancelled
Web App CI / test (channels shard 2/4) (push) Has been cancelled
Web App CI / test (channels shard 3/4) (push) Has been cancelled
Web App CI / test (channels shard 4/4) (push) Has been cancelled
Web App CI / upload-coverage (push) Has been cancelled
Web App CI / build (push) Has been cancelled
YAML Lint / yamllint (push) Has been cancelled
Push mirrored docker images / cd/Push mirrored docker images (push) Has been cancelled
docs-cd / Build and deploy docs (push) Has been cancelled
Docs CI / build (push) Has been cancelled
E2E Cache Warm: Cypress deps / Warm Cypress deps cache (push) Has been cancelled
Scorecards supply-chain security / Scorecard analysis (push) Has been cancelled
Server CI Weekly / Postgres FIPS (push) Has been skipped
Server CI Weekly / Run mmctl tests (FIPS) (push) Has been skipped
Server CI Weekly / Postgres with binary parameters (push) Has been skipped
Server CI Weekly / Build Environment (push) Failing after 1s
Server CI Nightly Race / Build Environment (push) Failing after 1s
Server CI Cache Warm / Warm Go Module and Build Cache (push) Failing after 2s
464 lines
11 KiB
Go
464 lines
11 KiB
Go
// Code generated by mockery v2.53.4. DO NOT EDIT.
|
|
|
|
// Regenerate this file using `make store-mocks`.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
model "github.com/mattermost/mattermost/server/public/model"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// UserAccessTokenStore is an autogenerated mock type for the UserAccessTokenStore type
|
|
type UserAccessTokenStore struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// CountNonCompliantExpiry provides a mock function with given fields: maxExpiresAt
|
|
func (_m *UserAccessTokenStore) CountNonCompliantExpiry(maxExpiresAt int64) (int64, error) {
|
|
ret := _m.Called(maxExpiresAt)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CountNonCompliantExpiry")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(int64) (int64, error)); ok {
|
|
return rf(maxExpiresAt)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(int64) int64); ok {
|
|
r0 = rf(maxExpiresAt)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(int64) error); ok {
|
|
r1 = rf(maxExpiresAt)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: tokenID
|
|
func (_m *UserAccessTokenStore) Delete(tokenID string) error {
|
|
ret := _m.Called(tokenID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Delete")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string) error); ok {
|
|
r0 = rf(tokenID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// DeleteAllForUser provides a mock function with given fields: userID
|
|
func (_m *UserAccessTokenStore) DeleteAllForUser(userID string) error {
|
|
ret := _m.Called(userID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeleteAllForUser")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string) error); ok {
|
|
r0 = rf(userID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// DeleteByIds provides a mock function with given fields: tokenIDs
|
|
func (_m *UserAccessTokenStore) DeleteByIds(tokenIDs []string) (int64, error) {
|
|
ret := _m.Called(tokenIDs)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeleteByIds")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func([]string) (int64, error)); ok {
|
|
return rf(tokenIDs)
|
|
}
|
|
if rf, ok := ret.Get(0).(func([]string) int64); ok {
|
|
r0 = rf(tokenIDs)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func([]string) error); ok {
|
|
r1 = rf(tokenIDs)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// DeleteNonCompliantExpiry provides a mock function with given fields: maxExpiresAt, limit
|
|
func (_m *UserAccessTokenStore) DeleteNonCompliantExpiry(maxExpiresAt int64, limit int) ([]string, error) {
|
|
ret := _m.Called(maxExpiresAt, limit)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeleteNonCompliantExpiry")
|
|
}
|
|
|
|
var r0 []string
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(int64, int) ([]string, error)); ok {
|
|
return rf(maxExpiresAt, limit)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(int64, int) []string); ok {
|
|
r0 = rf(maxExpiresAt, limit)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]string)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(int64, int) error); ok {
|
|
r1 = rf(maxExpiresAt, limit)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Get provides a mock function with given fields: tokenID
|
|
func (_m *UserAccessTokenStore) Get(tokenID string) (*model.UserAccessToken, error) {
|
|
ret := _m.Called(tokenID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Get")
|
|
}
|
|
|
|
var r0 *model.UserAccessToken
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string) (*model.UserAccessToken, error)); ok {
|
|
return rf(tokenID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) *model.UserAccessToken); ok {
|
|
r0 = rf(tokenID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.UserAccessToken)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
|
r1 = rf(tokenID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetAll provides a mock function with given fields: offset, limit
|
|
func (_m *UserAccessTokenStore) GetAll(offset int, limit int) ([]*model.UserAccessToken, error) {
|
|
ret := _m.Called(offset, limit)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetAll")
|
|
}
|
|
|
|
var r0 []*model.UserAccessToken
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(int, int) ([]*model.UserAccessToken, error)); ok {
|
|
return rf(offset, limit)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(int, int) []*model.UserAccessToken); ok {
|
|
r0 = rf(offset, limit)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.UserAccessToken)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(int, int) error); ok {
|
|
r1 = rf(offset, limit)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetByToken provides a mock function with given fields: tokenString
|
|
func (_m *UserAccessTokenStore) GetByToken(tokenString string) (*model.UserAccessToken, error) {
|
|
ret := _m.Called(tokenString)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetByToken")
|
|
}
|
|
|
|
var r0 *model.UserAccessToken
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string) (*model.UserAccessToken, error)); ok {
|
|
return rf(tokenString)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) *model.UserAccessToken); ok {
|
|
r0 = rf(tokenString)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.UserAccessToken)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
|
r1 = rf(tokenString)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetByUser provides a mock function with given fields: userID, page, perPage
|
|
func (_m *UserAccessTokenStore) GetByUser(userID string, page int, perPage int) ([]*model.UserAccessToken, error) {
|
|
ret := _m.Called(userID, page, perPage)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetByUser")
|
|
}
|
|
|
|
var r0 []*model.UserAccessToken
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, int, int) ([]*model.UserAccessToken, error)); ok {
|
|
return rf(userID, page, perPage)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, int, int) []*model.UserAccessToken); ok {
|
|
r0 = rf(userID, page, perPage)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.UserAccessToken)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, int, int) error); ok {
|
|
r1 = rf(userID, page, perPage)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetExpiredBefore provides a mock function with given fields: cutoff, limit
|
|
func (_m *UserAccessTokenStore) GetExpiredBefore(cutoff int64, limit int) ([]*model.UserAccessToken, error) {
|
|
ret := _m.Called(cutoff, limit)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetExpiredBefore")
|
|
}
|
|
|
|
var r0 []*model.UserAccessToken
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(int64, int) ([]*model.UserAccessToken, error)); ok {
|
|
return rf(cutoff, limit)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(int64, int) []*model.UserAccessToken); ok {
|
|
r0 = rf(cutoff, limit)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.UserAccessToken)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(int64, int) error); ok {
|
|
r1 = rf(cutoff, limit)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetExpiringTokens provides a mock function with given fields: now, thresholds, limit
|
|
func (_m *UserAccessTokenStore) GetExpiringTokens(now int64, thresholds []int, limit int) ([]*model.UserAccessToken, error) {
|
|
ret := _m.Called(now, thresholds, limit)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetExpiringTokens")
|
|
}
|
|
|
|
var r0 []*model.UserAccessToken
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(int64, []int, int) ([]*model.UserAccessToken, error)); ok {
|
|
return rf(now, thresholds, limit)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(int64, []int, int) []*model.UserAccessToken); ok {
|
|
r0 = rf(now, thresholds, limit)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.UserAccessToken)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(int64, []int, int) error); ok {
|
|
r1 = rf(now, thresholds, limit)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Save provides a mock function with given fields: token
|
|
func (_m *UserAccessTokenStore) Save(token *model.UserAccessToken) (*model.UserAccessToken, error) {
|
|
ret := _m.Called(token)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Save")
|
|
}
|
|
|
|
var r0 *model.UserAccessToken
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(*model.UserAccessToken) (*model.UserAccessToken, error)); ok {
|
|
return rf(token)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(*model.UserAccessToken) *model.UserAccessToken); ok {
|
|
r0 = rf(token)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.UserAccessToken)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(*model.UserAccessToken) error); ok {
|
|
r1 = rf(token)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Search provides a mock function with given fields: term
|
|
func (_m *UserAccessTokenStore) Search(term string) ([]*model.UserAccessToken, error) {
|
|
ret := _m.Called(term)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Search")
|
|
}
|
|
|
|
var r0 []*model.UserAccessToken
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string) ([]*model.UserAccessToken, error)); ok {
|
|
return rf(term)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) []*model.UserAccessToken); ok {
|
|
r0 = rf(term)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.UserAccessToken)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
|
r1 = rf(term)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// UpdateLastNotifiedAt provides a mock function with given fields: tokenID, notifiedAt
|
|
func (_m *UserAccessTokenStore) UpdateLastNotifiedAt(tokenID string, notifiedAt int64) error {
|
|
ret := _m.Called(tokenID, notifiedAt)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateLastNotifiedAt")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, int64) error); ok {
|
|
r0 = rf(tokenID, notifiedAt)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateTokenDisable provides a mock function with given fields: tokenID
|
|
func (_m *UserAccessTokenStore) UpdateTokenDisable(tokenID string) error {
|
|
ret := _m.Called(tokenID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateTokenDisable")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string) error); ok {
|
|
r0 = rf(tokenID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateTokenEnable provides a mock function with given fields: tokenID
|
|
func (_m *UserAccessTokenStore) UpdateTokenEnable(tokenID string) error {
|
|
ret := _m.Called(tokenID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateTokenEnable")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string) error); ok {
|
|
r0 = rf(tokenID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateTokenRotate provides a mock function with given fields: tokenID, newToken, expiresAt
|
|
func (_m *UserAccessTokenStore) UpdateTokenRotate(tokenID string, newToken string, expiresAt int64) error {
|
|
ret := _m.Called(tokenID, newToken, expiresAt)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateTokenRotate")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string, string, int64) error); ok {
|
|
r0 = rf(tokenID, newToken, expiresAt)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// NewUserAccessTokenStore creates a new instance of UserAccessTokenStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
// The first argument is typically a *testing.T value.
|
|
func NewUserAccessTokenStore(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *UserAccessTokenStore {
|
|
mock := &UserAccessTokenStore{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|