api-structs #117
@ -1,6 +1,7 @@
|
|||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"git.grassecon.net/urdt/ussd/internal/handlers/server"
|
||||||
"git.grassecon.net/urdt/ussd/internal/models"
|
"git.grassecon.net/urdt/ussd/internal/models"
|
||||||
"github.com/stretchr/testify/mock"
|
"github.com/stretchr/testify/mock"
|
||||||
)
|
)
|
||||||
@ -10,9 +11,19 @@ type MockAccountService struct {
|
|||||||
mock.Mock
|
mock.Mock
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MockAccountService) CreateAccount() (*models.AccountResponse, error) {
|
func (m *MockAccountService) CreateAccount() (*server.OKResponse, *server.ErrResponse) {
|
||||||
args := m.Called()
|
args := m.Called()
|
||||||
return args.Get(0).(*models.AccountResponse), args.Error(1)
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MockAccountService) CheckBalance(publicKey string) (*models.BalanceResponse, error) {
|
func (m *MockAccountService) CheckBalance(publicKey string) (*models.BalanceResponse, error) {
|
||||||
@ -23,4 +34,17 @@ func (m *MockAccountService) CheckBalance(publicKey string) (*models.BalanceResp
|
|||||||
func (m *MockAccountService) CheckAccountStatus(trackingId string) (*models.TrackStatusResponse, error) {
|
func (m *MockAccountService) CheckAccountStatus(trackingId string) (*models.TrackStatusResponse, error) {
|
||||||
args := m.Called(trackingId)
|
args := m.Called(trackingId)
|
||||||
return args.Get(0).(*models.TrackStatusResponse), args.Error(1)
|
return args.Get(0).(*models.TrackStatusResponse), args.Error(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user