assert_eq!(response.status(), StatusCode::OK);
assert_eq!(
response.text().unwrap(),
"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
);
}
#[test]
fn block_time_endpoint() {
let test_server = TestServer::new();
let response = test_server.get("/blocktime");
assert_eq!(response.status(), StatusCode::OK);
assert_eq!(response.text().unwrap(), "1231006505");
}
#[test]
fn range_end_before_range_start_returns_400() {
TestServer::new().assert_response(
"/range/1/0",
StatusCode::BAD_REQUEST,
"range start greater than range end",
);
}
#[test]
fn invalid_range_start_returns_400() {
TestServer::new().assert_response(
"/range/=/0",
StatusCode::BAD_REQUEST,
"Invalid URL: invalid digit found in string",
);
}
#[test]
fn invalid_range_end_returns_400() {
TestServer::new().assert_response(
"/range/0/=",
StatusCode::BAD_REQUEST,
"Invalid URL: invalid digit found in string",