1 use mockito::{mock, server_url};
2 
3 speculate::speculate! {
4     before {
5         env_logger::try_init().ok();
6     }
7 
8     test "returns correct response code" {
9         for status in [200u16, 202, 204, 302, 308, 400, 403, 404, 418, 429, 451, 500, 503].iter() {
10             let m = mock("GET", "/")
11                 .with_status(*status as usize)
12                 .create();
13 
14             let response = isahc::get(server_url()).unwrap();
15 
16             assert_eq!(response.status(), *status);
17             m.assert();
18         }
19     }
20 }
21