fix_: api_test.go

This commit is contained in:
Andrey Bocharnikov 2025-01-28 21:02:20 +04:00
parent 0fecac1948
commit e673ef35db

View File

@ -9,6 +9,8 @@ import (
"testing"
"time"
"github.com/status-im/status-go/params/networkhelper"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/event"
@ -135,13 +137,23 @@ func TestAPI_GetAddressDetails(t *testing.T) {
networks := []params.Network{
{
ChainID: chainID,
DefaultRPCURL: serverWith1SecDelay.URL + "/nodefleet/",
ChainID: chainID,
ChainName: "Ethereum Mainnet",
RpcProviders: []params.RpcProvider{
{
ChainID: chainID,
Name: "Test Provider",
URL: serverWith1SecDelay.URL + "/nodefleet/",
Type: params.EmbeddedProxyProviderType,
Enabled: true,
AuthType: params.NoAuth,
},
},
},
}
networks, err = rpc.UpdateEmbeddedProxyProviders(networks, true, gofakeit.Username(), gofakeit.LetterN(5))
require.NoError(t, err)
networks = networkhelper.OverrideEmbeddedProxyProviders(networks, true, gofakeit.Username(), gofakeit.LetterN(5))
require.NotEmpty(t, networks)
config := rpc.ClientConfig{
Client: nil,
@ -211,13 +223,6 @@ func TestAPI_FetchOrGetCachedWalletBalances(t *testing.T) {
defer mockCtrl.Finish()
mockReader := mock_reader.NewMockReaderInterface(mockCtrl)
providerConfig := params.ProviderConfig{
Enabled: true,
Name: rpc.ProviderStatusProxy,
User: "user1",
Password: "pass1",
}
providerConfigs := []params.ProviderConfig{providerConfig}
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, `{"result": "0x10"}`)
@ -228,8 +233,20 @@ func TestAPI_FetchOrGetCachedWalletBalances(t *testing.T) {
networks := []params.Network{
{
ChainID: chainID,
DefaultRPCURL: server.URL + "/nodefleet/",
ChainID: chainID,
ChainName: "Ethereum Mainnet",
RpcProviders: []params.RpcProvider{
{
ChainID: chainID,
Name: "Test Provider",
URL: server.URL + "/nodefleet/",
Type: params.EmbeddedProxyProviderType,
Enabled: true,
AuthType: params.BasicAuth,
AuthLogin: "user1",
AuthPassword: "pass1",
},
},
},
}
config := rpc.ClientConfig{
@ -238,7 +255,6 @@ func TestAPI_FetchOrGetCachedWalletBalances(t *testing.T) {
Networks: networks,
DB: appDB,
WalletFeed: nil,
ProviderConfigs: providerConfigs,
}
c, err := rpc.NewClient(config)
require.NoError(t, err)