feat: initial commit
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
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) 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) 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)
|
||||
}
|
||||
Reference in New Issue
Block a user