2020-11-08 14:46:12 +03:00
|
|
|
package mocks
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/muety/wakapi/models"
|
|
|
|
"github.com/stretchr/testify/mock"
|
|
|
|
)
|
|
|
|
|
|
|
|
type UserServiceMock struct {
|
|
|
|
mock.Mock
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *UserServiceMock) GetUserById(s string) (*models.User, error) {
|
|
|
|
args := m.Called(s)
|
|
|
|
return args.Get(0).(*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *UserServiceMock) GetUserByKey(s string) (*models.User, error) {
|
|
|
|
args := m.Called(s)
|
|
|
|
return args.Get(0).(*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2021-04-06 00:00:21 +03:00
|
|
|
func (m *UserServiceMock) GetUserByEmail(s string) (*models.User, error) {
|
|
|
|
args := m.Called(s)
|
|
|
|
return args.Get(0).(*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *UserServiceMock) GetUserByResetToken(s string) (*models.User, error) {
|
|
|
|
args := m.Called(s)
|
|
|
|
return args.Get(0).(*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2020-11-08 14:46:12 +03:00
|
|
|
func (m *UserServiceMock) GetAll() ([]*models.User, error) {
|
|
|
|
args := m.Called()
|
|
|
|
return args.Get(0).([]*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2022-10-06 15:34:46 +03:00
|
|
|
func (m *UserServiceMock) GetMany(s []string) ([]*models.User, error) {
|
|
|
|
args := m.Called(s)
|
|
|
|
return args.Get(0).([]*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *UserServiceMock) GetManyMapped(s []string) (map[string]*models.User, error) {
|
|
|
|
args := m.Called()
|
|
|
|
return args.Get(0).(map[string]*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *UserServiceMock) GetAllByLeaderboard(b bool) ([]*models.User, error) {
|
|
|
|
//TODO implement me
|
|
|
|
panic("implement me")
|
|
|
|
}
|
|
|
|
|
2021-04-30 15:07:14 +03:00
|
|
|
func (m *UserServiceMock) GetAllByReports(b bool) ([]*models.User, error) {
|
|
|
|
args := m.Called(b)
|
|
|
|
return args.Get(0).([]*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2022-12-30 15:41:27 +03:00
|
|
|
func (m *UserServiceMock) GetUserByStripeCustomerId(s string) (*models.User, error) {
|
|
|
|
args := m.Called(s)
|
|
|
|
return args.Get(0).(*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2021-06-26 13:42:51 +03:00
|
|
|
func (m *UserServiceMock) GetActive(b bool) ([]*models.User, error) {
|
|
|
|
args := m.Called(b)
|
2021-02-13 01:10:25 +03:00
|
|
|
return args.Get(0).([]*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2021-02-12 20:49:47 +03:00
|
|
|
func (m *UserServiceMock) Count() (int64, error) {
|
|
|
|
args := m.Called()
|
|
|
|
return int64(args.Int(0)), args.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *UserServiceMock) CreateOrGet(signup *models.Signup, isAdmin bool) (*models.User, bool, error) {
|
|
|
|
args := m.Called(signup, isAdmin)
|
2020-11-08 14:46:12 +03:00
|
|
|
return args.Get(0).(*models.User), args.Bool(1), args.Error(2)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *UserServiceMock) Update(user *models.User) (*models.User, error) {
|
|
|
|
args := m.Called(user)
|
|
|
|
return args.Get(0).(*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2021-02-03 00:54:22 +03:00
|
|
|
func (m *UserServiceMock) Delete(user *models.User) error {
|
|
|
|
args := m.Called(user)
|
|
|
|
return args.Error(0)
|
|
|
|
}
|
|
|
|
|
2020-11-08 14:46:12 +03:00
|
|
|
func (m *UserServiceMock) ResetApiKey(user *models.User) (*models.User, error) {
|
|
|
|
args := m.Called(user)
|
|
|
|
return args.Get(0).(*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *UserServiceMock) ToggleBadges(user *models.User) (*models.User, error) {
|
|
|
|
args := m.Called(user)
|
|
|
|
return args.Get(0).(*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2022-01-21 14:35:05 +03:00
|
|
|
func (m *UserServiceMock) SetWakatimeApiCredentials(user *models.User, s1, s2 string) (*models.User, error) {
|
|
|
|
args := m.Called(user, s1, s2)
|
2021-01-22 01:26:50 +03:00
|
|
|
return args.Get(0).(*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2020-11-08 14:46:12 +03:00
|
|
|
func (m *UserServiceMock) MigrateMd5Password(user *models.User, login *models.Login) (*models.User, error) {
|
|
|
|
args := m.Called(user, login)
|
|
|
|
return args.Get(0).(*models.User), args.Error(1)
|
|
|
|
}
|
2021-02-07 00:32:03 +03:00
|
|
|
|
2021-04-06 00:00:21 +03:00
|
|
|
func (m *UserServiceMock) GenerateResetToken(user *models.User) (*models.User, error) {
|
|
|
|
args := m.Called(user)
|
|
|
|
return args.Get(0).(*models.User), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2021-02-07 00:32:03 +03:00
|
|
|
func (m *UserServiceMock) FlushCache() {
|
|
|
|
m.Called()
|
|
|
|
}
|