status-go/t/e2e/rpc/client_test.go
Pedro Pombeiro 6cdea4ef97
Update codebase to leverage Whisper v6 (#703)
* Update project to use Whisper v6. Part of #638

* Revert "Add patch to downgrade usage of Whisper v6 to v5 in some geth 1.8.1 vendor files. Part of #665" - this reverts commit 6aefb4c8fd02dbcfffac6b69e8bb22b13ef86b6b.

* Enable light mode on Whisper v6 for non-mail servers. Part of #638

* Fix race condition in whisperv6/peer.go. Part of #665 (PR already accepted upstream for 1.8.2)

* Update bootnode addresses in staticnodes.json. Part of #638

* Add `shh.lightclient` flag and tests for bloom filter setting logic. Part of #638

* Move MakeTestNodeConfig to utils. Part of #638

* Reduce PoW in `whisper_jail_test.go` to fix flaky test. Part of #638
2018-03-02 10:25:30 +01: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"
e2e "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.NodeManagerTestSuite
}
func TestRPCClientTestSuite(t *testing.T) {
suite.Run(t, new(RPCClientTestSuite))
}
func (s *RPCClientTestSuite) SetupTest() {
s.NodeManager = node.NewNodeManager()
s.NotNil(s.NodeManager)
}
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)
}