mirror of
https://github.com/fafhrd91/actix-net
synced 2025-06-28 05:10:36 +02:00
use actix-testing instead of test server
This commit is contained in:
@ -29,7 +29,7 @@ log = "0.4"
|
||||
[dev-dependencies]
|
||||
actix-rt = "0.2.2"
|
||||
actix-connect = "0.2.0"
|
||||
actix-test-server = "0.2.2"
|
||||
actix-testing = "0.1.0"
|
||||
actix-server-config = "0.1.1"
|
||||
tokio-tcp = "0.1"
|
||||
tokio-timer = "0.2"
|
||||
|
@ -5,7 +5,7 @@ use std::time::Duration;
|
||||
use actix_codec::BytesCodec;
|
||||
use actix_server_config::Io;
|
||||
use actix_service::{new_apply_fn, Service};
|
||||
use actix_test_server::TestServer;
|
||||
use actix_testing::{self as test, TestServer};
|
||||
use futures::Future;
|
||||
use tokio_tcp::TcpStream;
|
||||
use tokio_timer::sleep;
|
||||
@ -19,7 +19,7 @@ fn test_disconnect() -> std::io::Result<()> {
|
||||
let disconnect = Arc::new(AtomicBool::new(false));
|
||||
let disconnect1 = disconnect.clone();
|
||||
|
||||
let mut srv = TestServer::with(move || {
|
||||
let srv = TestServer::with(move || {
|
||||
let disconnect1 = disconnect1.clone();
|
||||
|
||||
new_apply_fn(
|
||||
@ -41,15 +41,14 @@ fn test_disconnect() -> std::io::Result<()> {
|
||||
})
|
||||
.finish(|_t| Ok(None));
|
||||
|
||||
let conn = srv
|
||||
.block_on(
|
||||
actix_connect::default_connector()
|
||||
.call(actix_connect::Connect::with(String::new(), srv.addr())),
|
||||
)
|
||||
.unwrap();
|
||||
let conn = test::block_on(
|
||||
actix_connect::default_connector()
|
||||
.call(actix_connect::Connect::with(String::new(), srv.addr())),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
srv.block_on(client.call(conn.into_parts().0)).unwrap();
|
||||
let _ = srv.block_on(
|
||||
test::block_on(client.call(conn.into_parts().0)).unwrap();
|
||||
let _ = test::block_on(
|
||||
sleep(Duration::from_millis(100))
|
||||
.map(|_| ())
|
||||
.map_err(|_| ()),
|
||||
|
Reference in New Issue
Block a user