2018-07-16 07:40:40 +00:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-01-02 09:10:19 +00:00
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
|
2018-07-16 07:40:40 +00:00
|
|
|
"github.com/status-im/status-go/params"
|
2019-10-04 15:21:24 +00:00
|
|
|
"github.com/status-im/status-go/t/utils"
|
2018-07-16 07:40:40 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestPeerAPISuite(t *testing.T) {
|
2019-10-04 15:21:24 +00:00
|
|
|
utils.Init()
|
2018-07-16 07:40:40 +00:00
|
|
|
s := new(PeerAPISuite)
|
|
|
|
s.upstream = false
|
|
|
|
suite.Run(t, s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestPeerAPISuiteUpstream(t *testing.T) {
|
2019-10-04 15:21:24 +00:00
|
|
|
utils.Init()
|
2018-07-16 07:40:40 +00:00
|
|
|
s := new(PeerAPISuite)
|
|
|
|
s.upstream = true
|
|
|
|
suite.Run(t, s)
|
|
|
|
}
|
|
|
|
|
|
|
|
type PeerAPISuite struct {
|
|
|
|
BaseJSONRPCSuite
|
|
|
|
upstream bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *PeerAPISuite) TestAccessiblePeerAPIs() {
|
2019-10-04 15:21:24 +00:00
|
|
|
if s.upstream && utils.GetNetworkID() == params.StatusChainNetworkID {
|
2018-07-16 07:40:40 +00:00
|
|
|
s.T().Skip()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
err := s.SetupTest(s.upstream, true, false)
|
|
|
|
s.NoError(err)
|
|
|
|
defer func() {
|
|
|
|
err := s.Backend.StopNode()
|
|
|
|
s.NoError(err)
|
|
|
|
}()
|
|
|
|
// These peer APIs should be available
|
|
|
|
s.AssertAPIMethodExported("peer_discover")
|
|
|
|
}
|