laconicd/tests/rpc/net_test.go
JayT106 f69c887276
rpc: test fix (#608)
* fix rpc tests with net namespace

* skip personal test

* skip rpc pending test

* fix endpoint

* fix rpc pending test

* fix missing gas param in some rpc tests

* fix eth_getproof when the block number is equal to pending or latest

* fix rpc tests filter subscribe failed

* lint

* remove unused linter

* fix PendingTransactionFilter and TestEth_GetFilterChanges_BlockFilter

* fix eth_estimateGas

* fix TestEth_EstimateGas_ContractDeployment

* skip TestEth_ExportAccount_WithStorage

* remove sleep in rpc test

* Update changelog

* add test-rpc in github action

* bump golangci-lint version to v1.42.1
2021-10-07 18:41:27 +02:00

36 lines
690 B
Go

package rpc
import (
"encoding/json"
"testing"
"github.com/stretchr/testify/require"
)
func TestNet_Version(t *testing.T) {
rpcRes := Call(t, "net_version", []string{})
var res string
err := json.Unmarshal(rpcRes.Result, &res)
require.NoError(t, err)
require.Equal(t, "9000", res)
}
func TestNet_Listening(t *testing.T) {
rpcRes := Call(t, "net_listening", []string{})
var res bool
err := json.Unmarshal(rpcRes.Result, &res)
require.NoError(t, err)
require.True(t, res)
}
func TestNet_PeerCount(t *testing.T) {
rpcRes := Call(t, "net_peerCount", []string{})
var res int
err := json.Unmarshal(rpcRes.Result, &res)
require.NoError(t, err)
require.Equal(t, 0, res)
}