api-structs #117

Merged
lash merged 35 commits from api-structs into master 2024-10-24 15:53:46 +02:00
Showing only changes of commit 1c57c95d93 - Show all commits

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) {
@ -23,4 +34,17 @@ func (m *MockAccountService) CheckBalance(publicKey string) (*models.BalanceResp
func (m *MockAccountService) CheckAccountStatus(trackingId string) (*models.TrackStatusResponse, error) {
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
}