use api structs

This commit is contained in:
Carlosokumu 2024-10-18 17:04:02 +03:00
parent 128a354b34
commit 1c57c95d93
Signed by untrusted user: carlos
GPG Key ID: 7BD6BC8160A5C953

View File

@ -1,6 +1,7 @@
package mocks
import (
"git.grassecon.net/urdt/ussd/internal/handlers/server"
"git.grassecon.net/urdt/ussd/internal/models"
"github.com/stretchr/testify/mock"
)
@ -10,9 +11,19 @@ type MockAccountService struct {
mock.Mock
}
func (m *MockAccountService) CreateAccount() (*models.AccountResponse, error) {
func (m *MockAccountService) CreateAccount() (*server.OKResponse, *server.ErrResponse) {
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) {
@ -24,3 +35,16 @@ func (m *MockAccountService) CheckAccountStatus(trackingId string) (*models.Trac
args := m.Called(trackingId)
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
}