ussd/internal/mocks/servicemock.go

51 lines
1.3 KiB
Go
Raw Normal View History

2024-09-07 08:55:00 +02:00
package mocks
import (
2024-10-18 16:04:02 +02:00
"git.grassecon.net/urdt/ussd/internal/handlers/server"
2024-09-07 08:55:00 +02:00
"git.grassecon.net/urdt/ussd/internal/models"
"github.com/stretchr/testify/mock"
)
// MockAccountService implements AccountServiceInterface for testing
type MockAccountService struct {
mock.Mock
}
2024-10-18 16:04:02 +02:00
func (m *MockAccountService) CreateAccount() (*server.OKResponse, *server.ErrResponse) {
2024-09-07 08:55:00 +02:00
args := m.Called()
2024-10-18 16:04:02 +02:00
okResponse, ok := args.Get(0).(*server.OKResponse)
errResponse, err := args.Get(1).(*server.ErrResponse)
if ok {
return okResponse, nil
}
if err {
return nil, errResponse
}
return nil, nil
2024-09-07 08:55:00 +02:00
}
2024-10-14 22:17:57 +02:00
func (m *MockAccountService) CheckBalance(publicKey string) (*models.BalanceResponse, error) {
2024-09-07 08:55:00 +02:00
args := m.Called(publicKey)
2024-10-14 22:17:57 +02:00
return args.Get(0).(*models.BalanceResponse), args.Error(1)
2024-09-07 08:55:00 +02:00
}
2024-10-14 22:17:57 +02:00
func (m *MockAccountService) CheckAccountStatus(trackingId string) (*models.TrackStatusResponse, error) {
2024-09-07 08:55:00 +02:00
args := m.Called(trackingId)
2024-10-14 22:17:57 +02:00
return args.Get(0).(*models.TrackStatusResponse), args.Error(1)
2024-10-18 16:04:02 +02:00
}
func (m *MockAccountService) TrackAccountStatus(publicKey string) (*server.OKResponse, *server.ErrResponse) {
args := m.Called(publicKey)
okResponse, ok := args.Get(0).(*server.OKResponse)
errResponse, err := args.Get(1).(*server.ErrResponse)
if ok {
return okResponse, nil
}
if err {
return nil, errResponse
}
return nil, nil
}