1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
mod test_server;
pub use self::test_server::*;
mod test_response;
pub use self::test_response::*;
pub mod util;
#[cfg(test)]
mod test {
use super::*;
use ::axum::routing::get;
use ::axum::Router;
async fn get_ping() -> &'static str {
"pong!"
}
#[tokio::test]
async fn it_sound_get() {
let app = Router::new()
.route("/ping", get(get_ping))
.into_make_service();
let server = TestServer::new(app);
server.get("/ping").await.assert_contents(&"pong!");
}
}