2020-11-14 14:30:45 +03:00
|
|
|
package mocks
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/muety/wakapi/models"
|
|
|
|
"github.com/stretchr/testify/mock"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type HeartbeatServiceMock struct {
|
|
|
|
mock.Mock
|
|
|
|
}
|
|
|
|
|
2021-02-05 20:52:21 +03:00
|
|
|
func (m *HeartbeatServiceMock) Insert(heartbeat *models.Heartbeat) error {
|
|
|
|
args := m.Called(heartbeat)
|
|
|
|
return args.Error(0)
|
|
|
|
}
|
|
|
|
|
2020-11-14 14:30:45 +03:00
|
|
|
func (m *HeartbeatServiceMock) InsertBatch(heartbeats []*models.Heartbeat) error {
|
|
|
|
args := m.Called(heartbeats)
|
|
|
|
return args.Error(0)
|
|
|
|
}
|
|
|
|
|
2022-03-19 12:30:32 +03:00
|
|
|
func (m *HeartbeatServiceMock) Count(a bool) (int64, error) {
|
|
|
|
args := m.Called(a)
|
2021-02-12 20:37:30 +03:00
|
|
|
return int64(args.Int(0)), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2021-02-05 20:52:21 +03:00
|
|
|
func (m *HeartbeatServiceMock) CountByUser(user *models.User) (int64, error) {
|
|
|
|
args := m.Called(user)
|
|
|
|
return args.Get(0).(int64), args.Error(0)
|
|
|
|
}
|
|
|
|
|
2021-02-13 13:23:58 +03:00
|
|
|
func (m *HeartbeatServiceMock) CountByUsers(users []*models.User) ([]*models.CountByUser, error) {
|
|
|
|
args := m.Called(users)
|
|
|
|
return args.Get(0).([]*models.CountByUser), args.Error(0)
|
|
|
|
}
|
|
|
|
|
2020-11-14 14:30:45 +03:00
|
|
|
func (m *HeartbeatServiceMock) GetAllWithin(time time.Time, time2 time.Time, user *models.User) ([]*models.Heartbeat, error) {
|
|
|
|
args := m.Called(time, time2, user)
|
|
|
|
return args.Get(0).([]*models.Heartbeat), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2022-03-13 10:17:50 +03:00
|
|
|
func (m *HeartbeatServiceMock) GetAllWithinByFilters(time time.Time, time2 time.Time, user *models.User, filters *models.Filters) ([]*models.Heartbeat, error) {
|
|
|
|
args := m.Called(time, time2, user, filters)
|
|
|
|
return args.Get(0).([]*models.Heartbeat), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2020-11-14 14:30:45 +03:00
|
|
|
func (m *HeartbeatServiceMock) GetFirstByUsers() ([]*models.TimeByUser, error) {
|
|
|
|
args := m.Called()
|
|
|
|
return args.Get(0).([]*models.TimeByUser), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2021-04-30 11:12:28 +03:00
|
|
|
func (m *HeartbeatServiceMock) GetLatestByUser(user *models.User) (*models.Heartbeat, error) {
|
|
|
|
args := m.Called(user)
|
|
|
|
return args.Get(0).(*models.Heartbeat), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2021-02-06 02:35:35 +03:00
|
|
|
func (m *HeartbeatServiceMock) GetLatestByOriginAndUser(s string, user *models.User) (*models.Heartbeat, error) {
|
|
|
|
args := m.Called(s, user)
|
|
|
|
return args.Get(0).(*models.Heartbeat), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2021-05-01 14:52:03 +03:00
|
|
|
func (m *HeartbeatServiceMock) GetEntitySetByUser(u uint8, user *models.User) ([]string, error) {
|
|
|
|
args := m.Called(u, user)
|
|
|
|
return args.Get(0).([]string), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2020-11-14 14:30:45 +03:00
|
|
|
func (m *HeartbeatServiceMock) DeleteBefore(time time.Time) error {
|
|
|
|
args := m.Called(time)
|
|
|
|
return args.Error(0)
|
|
|
|
}
|
2022-03-17 13:55:13 +03:00
|
|
|
|
|
|
|
func (m *HeartbeatServiceMock) DeleteByUser(u *models.User) error {
|
|
|
|
args := m.Called(u)
|
|
|
|
return args.Error(0)
|
|
|
|
}
|