1
0
mirror of https://github.com/actix/examples synced 2025-06-28 18:00:37 +02:00

Fix examples of diesel and json (#207)

This commit is contained in:
Yuki Okushi
2019-12-11 11:33:12 +09:00
committed by GitHub
parent 998f92d2e3
commit 5ffbaacdce
3 changed files with 10 additions and 8 deletions

View File

@ -90,10 +90,12 @@ mod tests {
use actix_web::dev::Service;
use actix_web::{http, test, web, App};
#[test]
fn test_index() -> Result<(), Error> {
let app = App::new().route("/", web::post().to(index));
let mut app = test::init_service(app);
#[actix_rt::test]
async fn test_index() -> Result<(), Error> {
let mut app = test::init_service(
App::new().service(web::resource("/").route(web::post().to(index))),
)
.await;
let req = test::TestRequest::post()
.uri("/")
@ -102,7 +104,7 @@ mod tests {
number: 43,
})
.to_request();
let resp = test::block_on(app.call(req)).unwrap();
let resp = app.call(req).await.unwrap();
assert_eq!(resp.status(), http::StatusCode::OK);