1
0
mirror of https://github.com/actix/examples synced 2025-06-26 17:17:42 +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

@ -6,8 +6,9 @@ workspace = ".."
edition = "2018"
[dependencies]
actix-web = "2.0.0-alpha.3"
actix-web = "2.0.0-alpha.4"
actix-rt = "1.0.0-alpha.3"
actix-service = "1.0.0-alpha.4"
bytes = "0.5.2"
futures = "0.3.1"

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);