tests-refactor #137

Merged
lash merged 24 commits from tests-refactor into master 2024-10-28 16:28:42 +01:00
Showing only changes of commit a3be98c514 - Show all commits

View File

@ -1,31 +1,29 @@
package testservice package testservice
import ( import (
"context"
"encoding/json" "encoding/json"
"time" "time"
"git.grassecon.net/urdt/ussd/internal/models" "git.grassecon.net/urdt/ussd/internal/models"
"github.com/grassrootseconomics/eth-custodial/pkg/api"
) )
type TestAccountService struct { type TestAccountService struct {
} }
func (tas *TestAccountService) CreateAccount() (*models.AccountResponse, error) { func (tas *TestAccountService) CreateAccount(ctx context.Context) (*api.OKResponse, error) {
return &models.AccountResponse{ return &api.OKResponse{
Ok: true, Ok: true,
Result: struct { Description: "Account creation succeeded",
CustodialId json.Number `json:"custodialId"` Result: map[string]any{
PublicKey string `json:"publicKey"` "trackingId": "075ccc86-f6ef-4d33-97d5-e91cfb37aa0d",
TrackingId string `json:"trackingId"` "publicKey": "0x623EFAFa8868df4B934dd12a8B26CB3Dd75A7AdD",
}{
CustodialId: json.Number("182"),
PublicKey: "0x48ADca309b5085852207FAaf2816eD72B52F527C",
TrackingId: "28ebe84d-b925-472c-87ae-bbdfa1fb97be",
}, },
}, nil }, nil
} }
func (tas *TestAccountService) CheckBalance(publicKey string) (*models.BalanceResponse, error) { func (tas *TestAccountService) CheckBalance(ctx context.Context, publicKey string) (*models.BalanceResponse, error) {
balanceResponse := &models.BalanceResponse{ balanceResponse := &models.BalanceResponse{
Ok: true, Ok: true,
Result: struct { Result: struct {
@ -40,7 +38,7 @@ func (tas *TestAccountService) CheckBalance(publicKey string) (*models.BalanceRe
return balanceResponse, nil return balanceResponse, nil
} }
func (tas *TestAccountService) CheckAccountStatus(trackingId string) (*models.TrackStatusResponse, error) { func (tas *TestAccountService) CheckAccountStatus(ctx context.Context, trackingId string) (*models.TrackStatusResponse, error) {
trackResponse := &models.TrackStatusResponse{ trackResponse := &models.TrackStatusResponse{
Ok: true, Ok: true,
Result: struct { Result: struct {
@ -63,3 +61,13 @@ func (tas *TestAccountService) CheckAccountStatus(trackingId string) (*models.Tr
} }
return trackResponse, nil return trackResponse, nil
} }
func (tas *TestAccountService) TrackAccountStatus(ctx context.Context, publicKey string) (*api.OKResponse, error) {
return &api.OKResponse{
Ok: true,
Description: "Account creation succeeded",
Result: map[string]any{
"active": true,
},
}, nil
}