sync_provider function
This commit is contained in:
parent
3479a9bf95
commit
18939462c3
@ -19,12 +19,16 @@ use jsonrpc_core::IoHandler;
|
|||||||
use v1::{Net, NetClient};
|
use v1::{Net, NetClient};
|
||||||
use v1::tests::helpers::{Config, TestSyncProvider};
|
use v1::tests::helpers::{Config, TestSyncProvider};
|
||||||
|
|
||||||
#[test]
|
fn sync_provider() -> Arc<TestSyncProvider> {
|
||||||
fn rpc_net_version() {
|
Arc::new(TestSyncProvider::new(Config {
|
||||||
let sync = Arc::new(TestSyncProvider::new(Config {
|
|
||||||
protocol_version: 65,
|
protocol_version: 65,
|
||||||
num_peers: 120,
|
num_peers: 120,
|
||||||
}));
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn rpc_net_version() {
|
||||||
|
let sync = sync_provider();
|
||||||
let net = NetClient::new(&sync).to_delegate();
|
let net = NetClient::new(&sync).to_delegate();
|
||||||
let io = IoHandler::new();
|
let io = IoHandler::new();
|
||||||
io.add_delegate(net);
|
io.add_delegate(net);
|
||||||
@ -37,10 +41,7 @@ fn rpc_net_version() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn rpc_net_peer_count() {
|
fn rpc_net_peer_count() {
|
||||||
let sync = Arc::new(TestSyncProvider::new(Config {
|
let sync = sync_provider();
|
||||||
protocol_version: 65,
|
|
||||||
num_peers: 120,
|
|
||||||
}));
|
|
||||||
let net = NetClient::new(&sync).to_delegate();
|
let net = NetClient::new(&sync).to_delegate();
|
||||||
let io = IoHandler::new();
|
let io = IoHandler::new();
|
||||||
io.add_delegate(net);
|
io.add_delegate(net);
|
||||||
@ -53,10 +54,7 @@ fn rpc_net_peer_count() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn rpc_net_listening() {
|
fn rpc_net_listening() {
|
||||||
let sync = Arc::new(TestSyncProvider::new(Config {
|
let sync = sync_provider();
|
||||||
protocol_version: 65,
|
|
||||||
num_peers: 120,
|
|
||||||
}));
|
|
||||||
let net = NetClient::new(&sync).to_delegate();
|
let net = NetClient::new(&sync).to_delegate();
|
||||||
let io = IoHandler::new();
|
let io = IoHandler::new();
|
||||||
io.add_delegate(net);
|
io.add_delegate(net);
|
||||||
|
Loading…
Reference in New Issue
Block a user