mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-25 09:59:21 +02:00
allow to use application factory for test server
This commit is contained in:
@ -9,11 +9,18 @@ use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use actix_web::*;
|
||||
|
||||
#[test]
|
||||
fn test_serve() {
|
||||
fn test_simple() {
|
||||
let srv = test::TestServer::new(|app| app.handler(httpcodes::HTTPOk));
|
||||
assert!(reqwest::get(&srv.url("/")).unwrap().status().is_success());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_application() {
|
||||
let srv = test::TestServer::with_factory(
|
||||
|| Application::new().resource("/", |r| r.h(httpcodes::HTTPOk)));
|
||||
assert!(reqwest::get(&srv.url("/")).unwrap().status().is_success());
|
||||
}
|
||||
|
||||
struct MiddlewareTest {
|
||||
start: Arc<AtomicUsize>,
|
||||
response: Arc<AtomicUsize>,
|
||||
|
Reference in New Issue
Block a user