Scope: Fix tests

This commit is contained in:
Denys Vitali 2019-05-31 18:24:46 +02:00
parent 08ce463297
commit db61807acc
No known key found for this signature in database
GPG Key ID: 8883F38950E654A4
1 changed files with 22 additions and 2 deletions

View File

@ -1085,8 +1085,8 @@ mod tests {
let mut srv = init_service(
App::new().service(
web::scope("/app")
.configure(||{
.configure(|s|{
s.route("/path1", web::get().to(||HttpResponse::Ok()));
})
),
);
@ -1095,4 +1095,24 @@ mod tests {
let resp = block_on(srv.call(req)).unwrap();
assert_eq!(resp.status(), StatusCode::OK);
}
#[test]
fn test_scope_config_2() {
let mut srv = init_service(
App::new().service(
web::scope("/app")
.configure(|s|{
s.service(
web::scope("/v1")
.configure(|s|{
s.route("/", web::get().to(||HttpResponse::Ok()));
}));
})
),
);
let req = TestRequest::with_uri("/app/v1/").to_request();
let resp = block_on(srv.call(req)).unwrap();
assert_eq!(resp.status(), StatusCode::OK);
}
}