status-go/t/e2e/rpc/client_test.go
Frank Mueller 6598371dc0
Prepare tests for mainnet (#831)
* Start enabling to test Mainnet

* Minor corrections found during code scan

* Set mainnet blocker in E2E again

* Introduced securing of mainnet transaction tests

* Fix typing error

* Typo led to follow-up errors

* Linter problem

* Change to individual test skips after review

* More flexible skip control for mainnet and status chain

* Fix double space

* Change of skipping method and fixing wrong skipped networks
2018-04-18 17:13:27 +02:00

49 lines
1.2 KiB
Go

package rpc
import (
"testing"
"github.com/status-im/status-go/geth/node"
"github.com/status-im/status-go/geth/rpc"
"github.com/status-im/status-go/t/e2e"
. "github.com/status-im/status-go/t/utils" //nolint: golint
"github.com/stretchr/testify/suite"
)
type RPCClientTestSuite struct {
e2e.StatusNodeTestSuite
}
func TestRPCClientTestSuite(t *testing.T) {
suite.Run(t, new(RPCClientTestSuite))
}
func (s *RPCClientTestSuite) SetupTest() {
s.StatusNode = node.New()
s.NotNil(s.StatusNode)
}
func (s *RPCClientTestSuite) TestNewClient() {
config, err := MakeTestNodeConfig(GetNetworkID())
s.NoError(err)
// upstream disabled
s.False(config.UpstreamConfig.Enabled)
_, err = rpc.NewClient(nil, config.UpstreamConfig)
s.NoError(err)
// upstream enabled with correct URL
upstreamGood := config.UpstreamConfig
upstreamGood.Enabled = true
upstreamGood.URL = "http://example.com/rpc"
_, err = rpc.NewClient(nil, upstreamGood)
s.NoError(err)
// upstream enabled with incorrect URL
upstreamBad := config.UpstreamConfig
upstreamBad.Enabled = true
upstreamBad.URL = "///__httphh://///incorrect_urlxxx"
_, err = rpc.NewClient(nil, upstreamBad)
s.Error(err)
}