WIP replaced check account method but traversal crashes

This commit is contained in:
lash 2024-10-31 12:38:31 +00:00
parent b2d180e8eb
commit 3ae75b27a5
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 6 additions and 5 deletions

View File

@ -20,7 +20,7 @@ import (
"git.grassecon.net/urdt/ussd/common" "git.grassecon.net/urdt/ussd/common"
"github.com/alecthomas/assert/v2" "github.com/alecthomas/assert/v2"
"github.com/grassrootseconomics/eth-custodial/pkg/api" // "github.com/grassrootseconomics/eth-custodial/pkg/api"
testdataloader "github.com/peteole/testdata-loader" testdataloader "github.com/peteole/testdata-loader"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -1048,7 +1048,7 @@ func TestCheckAccountStatus(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
input []byte input []byte
serverResponse *api.OKResponse //serverResponse *api.OKResponse
response *models.TrackStatusResult response *models.TrackStatusResult
expectedResult resource.Result expectedResult resource.Result
}{ }{
@ -1086,7 +1086,8 @@ func TestCheckAccountStatus(t *testing.T) {
// Define expected interactions with the mock // Define expected interactions with the mock
mockDataStore.On("ReadEntry", ctx, sessionId, common.DATA_PUBLIC_KEY).Return(tt.input, nil) mockDataStore.On("ReadEntry", ctx, sessionId, common.DATA_PUBLIC_KEY).Return(tt.input, nil)
mockCreateAccountService.On("TrackAccountStatus", string(tt.input)).Return(tt.serverResponse, nil) //mockCreateAccountService.On("TrackAccountStatus", string(tt.input)).Return(tt.serverResponse, nil)
mockCreateAccountService.On("TrackAccountStatus", string(tt.input)).Return(tt.response, nil)
mockDataStore.On("WriteEntry", ctx, sessionId, common.DATA_ACCOUNT_STATUS, status).Return(nil).Maybe() mockDataStore.On("WriteEntry", ctx, sessionId, common.DATA_ACCOUNT_STATUS, status).Return(nil).Maybe()
// Call the method under test // Call the method under test

View File

@ -36,10 +36,10 @@ type AccountService struct {
// - string: The status of the transaction as a string. If there is an error during the request or processing, this will be an empty string. // - string: The status of the transaction as a string. If there is an error during the request or processing, this will be an empty string.
// - error: An error if any occurred during the HTTP request, reading the response, or unmarshalling the JSON data. // - error: An error if any occurred during the HTTP request, reading the response, or unmarshalling the JSON data.
// If no error occurs, this will be nil // If no error occurs, this will be nil
func (as *AccountService) TrackAccountStatus(ctx context.Context, trackingId string) (*models.TrackStatusResult, error) { func (as *AccountService) TrackAccountStatus(ctx context.Context, publicKey string) (*models.TrackStatusResult, error) {
var r models.TrackStatusResult var r models.TrackStatusResult
ep, err := url.JoinPath(config.TrackURL, trackingId) ep, err := url.JoinPath(config.TrackURL, publicKey)
if err != nil { if err != nil {
return nil, err return nil, err
} }