34 lines
628 B
Go
34 lines
628 B
Go
package cache
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/FernandoVideira/LK_API_Temp/internal/store"
|
|
"github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
func NewMockCache() Storage {
|
|
return Storage{
|
|
Users: &MockUserStore{},
|
|
}
|
|
}
|
|
|
|
type MockUserStore struct {
|
|
mock.Mock
|
|
}
|
|
|
|
func (m *MockUserStore) Get(ctx context.Context, id int64) (*store.User, error) {
|
|
args := m.Called(id)
|
|
return nil, args.Error(1)
|
|
}
|
|
|
|
func (m *MockUserStore) Set(ctx context.Context, user *store.User) error {
|
|
args := m.Called(user)
|
|
return args.Error(0)
|
|
}
|
|
|
|
func (m *MockUserStore) Delete(ctx context.Context, id int64) error {
|
|
args := m.Called(id)
|
|
return args.Error(0)
|
|
}
|