cuprate_test_utils ::rpc ::data ::json Constant GET_CONNECTIONS_RESPONSE Copy item path Source pub const GET_CONNECTIONS_RESPONSE: &str = r#"{
"id": "0",
"jsonrpc": "2.0",
"result": {
"connections": [{
"address": "3evk3kezfjg44ma6tvesy7rbxwwpgpympj45xar5fo4qajrsmkoaqdqd.onion:18083",
"address_type": 4,
"avg_download": 0,
"avg_upload": 0,
"connection_id": "22ef856d0f1d44cc95e84fecfd065fe2",
"current_download": 0,
"current_upload": 0,
"height": 3195026,
"host": "3evk3kezfjg44ma6tvesy7rbxwwpgpympj45xar5fo4qajrsmkoaqdqd.onion",
"incoming": false,
"ip": "",
"live_time": 76651,
"local_ip": false,
"localhost": false,
"peer_id": "0000000000000001",
"port": "",
"pruning_seed": 0,
"recv_count": 240328,
"recv_idle_time": 34,
"rpc_credits_per_hash": 0,
"rpc_port": 0,
"send_count": 3406572,
"send_idle_time": 30,
"state": "normal",
"support_flags": 0
},{
"address": "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion:18083",
"address_type": 4,
"avg_download": 0,
"avg_upload": 0,
"connection_id": "c7734e15936f485a86d2b0534f87e499",
"current_download": 0,
"current_upload": 0,
"height": 3195024,
"host": "4iykytmumafy5kjahdqc7uzgcs34s2vwsadfjpk4znvsa5vmcxeup2qd.onion",
"incoming": false,
"ip": "",
"live_time": 76755,
"local_ip": false,
"localhost": false,
"peer_id": "0000000000000001",
"port": "",
"pruning_seed": 389,
"recv_count": 237657,
"recv_idle_time": 120,
"rpc_credits_per_hash": 0,
"rpc_port": 0,
"send_count": 3370566,
"send_idle_time": 120,
"state": "normal",
"support_flags": 0
}],
"status": "OK",
"untrusted": false
}
}"#;
Expand description Documentation , request .
use cuprate_test_utils::rpc::data::json::* ;
use serde_json::{to_value, Value};
let value = serde_json::from_str::<Value>(& GET_CONNECTIONS_RESPONSE).unwrap();
let Value::Object(map) = value else {
panic! ();
};
assert_eq! (map.get("jsonrpc" ).unwrap(), "2.0" );
map.get("id" ).unwrap();
if map.get("method" ).is_some() {
return ;
}
if map.get("result" ).is_none() {
map.get("error" ).unwrap();
}