Constant cuprate_test_utils::rpc::data::json::GET_BANS_RESPONSE

source ยท
pub const GET_BANS_RESPONSE: &str = r#"{
  "id": "0",
  "jsonrpc": "2.0",
  "result": {
    "bans": [{
      "host": "104.248.206.131",
      "ip": 2211379304,
      "seconds": 689754
    },{
      "host": "209.222.252.0\/24",
      "ip": 0,
      "seconds": 689754
    }],
    "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_BANS_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();
}