mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 22:49:21 +02:00
update tests
This commit is contained in:
@ -30,12 +30,11 @@ default = ["session"]
|
||||
session = ["cookie/secure"]
|
||||
|
||||
# openssl
|
||||
ssl = ["openssl", "actix-http/ssl", "actix-server/ssl", "awc/ssl"]
|
||||
ssl = ["openssl", "actix-server/ssl", "awc/ssl"]
|
||||
|
||||
[dependencies]
|
||||
actix-codec = "0.1.1"
|
||||
actix-rt = "0.2.1"
|
||||
actix-http = { path = "../actix-http" }
|
||||
actix-service = "0.3.4"
|
||||
actix-server = "0.4.0"
|
||||
actix-utils = "0.3.4"
|
||||
@ -61,4 +60,4 @@ tokio-timer = "0.2"
|
||||
openssl = { version="0.10", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
actix-web = { path = ".." }
|
||||
actix-web = "1.0.0-alpha.1"
|
||||
|
@ -3,12 +3,12 @@ use std::sync::mpsc;
|
||||
use std::{net, thread, time};
|
||||
|
||||
use actix_codec::{AsyncRead, AsyncWrite, Framed};
|
||||
use actix_http::client::Connector;
|
||||
use actix_http::ws;
|
||||
use actix_rt::{Runtime, System};
|
||||
use actix_server::{Server, StreamServiceFactory};
|
||||
use awc::{Client, ClientRequest};
|
||||
use futures::future::{lazy, Future};
|
||||
use awc::{error::PayloadError, ws, Client, ClientRequest, ClientResponse, Connector};
|
||||
use bytes::Bytes;
|
||||
use futures::future::lazy;
|
||||
use futures::{Future, Stream};
|
||||
use http::Method;
|
||||
use net2::TcpBuilder;
|
||||
|
||||
@ -193,13 +193,16 @@ impl TestServerRuntime {
|
||||
self.client.request(method, path.as_ref())
|
||||
}
|
||||
|
||||
/// Stop http server
|
||||
fn stop(&mut self) {
|
||||
System::current().stop();
|
||||
pub fn load_body<S>(
|
||||
&mut self,
|
||||
response: ClientResponse<S>,
|
||||
) -> Result<Bytes, PayloadError>
|
||||
where
|
||||
S: Stream<Item = Bytes, Error = PayloadError> + 'static,
|
||||
{
|
||||
self.block_on(response.body().limit(10_485_760))
|
||||
}
|
||||
}
|
||||
|
||||
impl TestServerRuntime {
|
||||
/// Connect to websocket server at a given path
|
||||
pub fn ws_at(
|
||||
&mut self,
|
||||
@ -219,6 +222,11 @@ impl TestServerRuntime {
|
||||
{
|
||||
self.ws_at("/")
|
||||
}
|
||||
|
||||
/// Stop http server
|
||||
fn stop(&mut self) {
|
||||
System::current().stop();
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for TestServerRuntime {
|
||||
|
Reference in New Issue
Block a user