Files
LK_API_Temp/internal/store/mocks.go
T

75 lines
1.8 KiB
Go

package store
import (
"context"
"database/sql"
"time"
"github.com/stretchr/testify/mock"
)
func NewMockStorage() Storage {
return Storage{
Users: &MockUserStore{},
}
}
type MockUserStore struct {
mock.Mock
}
func (m *MockUserStore) Create(ctx context.Context, tx *sql.Tx, user *User) error {
args := m.Called(tx, user)
return args.Error(0)
}
func (m *MockUserStore) Activate(ctx context.Context, token string) error {
args := m.Called(token)
return args.Error(0)
}
func (m *MockUserStore) GetAll(ctx context.Context, userID int64, roleLevel int64) ([]*User, error) {
args := m.Called(userID, roleLevel)
return nil, args.Error(1)
}
func (m *MockUserStore) GetByID(ctx context.Context, id int64) (*User, error) {
args := m.Called(id)
return nil, args.Error(1)
}
func (m *MockUserStore) GetByEmail(ctx context.Context, email string) (*User, error) {
args := m.Called(email)
return nil, args.Error(1)
}
func (m *MockUserStore) Update(ctx context.Context, user *User) error {
args := m.Called(user)
return args.Error(0)
}
func (m *MockUserStore) CreateAndInvite(ctx context.Context, user *User, token string, expiresAt time.Duration) error {
args := m.Called(user, token, expiresAt)
return args.Error(0)
}
func (m *MockUserStore) PasswordResetRequest(ctx context.Context, userID int64, token string, expiration time.Duration) error {
args := m.Called(ctx, userID, token, expiration)
return args.Error(0)
}
func (m *MockUserStore) ResetPassword(ctx context.Context, token string, password string) error {
args := m.Called(ctx, token, password)
return args.Error(0)
}
func (m *MockUserStore) Delete(ctx context.Context, id int64) error {
args := m.Called(id)
return args.Error(0)
}
func (m *MockUserStore) DeleteUser(ctx context.Context, id int64) error {
args := m.Called(id)
return args.Error(0)
}