From 1f9467e880aaa53b3c2186070a0f1dca447499c5 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 14 Mar 2019 12:01:35 -0700 Subject: [PATCH] update tests --- tests/test_httpserver.rs | 2 +- tests/test_server.rs | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/test_httpserver.rs b/tests/test_httpserver.rs index d2bc07ac..764d50ca 100644 --- a/tests/test_httpserver.rs +++ b/tests/test_httpserver.rs @@ -50,7 +50,7 @@ fn test_start() { let mut connector = test::run_on(|| { Ok::<_, ()>( - client::Connector::default() + client::Connector::new() .timeout(Duration::from_millis(100)) .service(), ) diff --git a/tests/test_server.rs b/tests/test_server.rs index ebe968fa..ffdc473a 100644 --- a/tests/test_server.rs +++ b/tests/test_server.rs @@ -69,7 +69,7 @@ fn test_body_gzip() { assert!(response.status().is_success()); // read response - let bytes = srv.execute(response.body()).unwrap(); + let bytes = srv.block_on(response.body()).unwrap(); // decode let mut e = GzDecoder::new(&bytes[..]); @@ -100,7 +100,7 @@ fn test_body_gzip_large() { assert!(response.status().is_success()); // read response - let bytes = srv.execute(response.body()).unwrap(); + let bytes = srv.block_on(response.body()).unwrap(); // decode let mut e = GzDecoder::new(&bytes[..]); @@ -134,7 +134,7 @@ fn test_body_gzip_large_random() { assert!(response.status().is_success()); // read response - let bytes = srv.execute(response.body()).unwrap(); + let bytes = srv.block_on(response.body()).unwrap(); // decode let mut e = GzDecoder::new(&bytes[..]); @@ -167,7 +167,7 @@ fn test_body_chunked_implicit() { ); // read response - let bytes = srv.execute(response.body()).unwrap(); + let bytes = srv.block_on(response.body()).unwrap(); // decode let mut e = GzDecoder::new(&bytes[..]); @@ -195,7 +195,7 @@ fn test_body_br_streaming() { assert!(response.status().is_success()); // read response - let bytes = srv.execute(response.body()).unwrap(); + let bytes = srv.block_on(response.body()).unwrap(); // decode br let mut e = BrotliDecoder::new(Vec::with_capacity(2048)); @@ -222,7 +222,7 @@ fn test_head_binary() { } // read response - let bytes = srv.execute(response.body()).unwrap(); + let bytes = srv.block_on(response.body()).unwrap(); assert!(bytes.is_empty()); } @@ -245,7 +245,7 @@ fn test_no_chunking() { assert!(!response.headers().contains_key(TRANSFER_ENCODING)); // read response - let bytes = srv.execute(response.body()).unwrap(); + let bytes = srv.block_on(response.body()).unwrap(); assert_eq!(bytes, Bytes::from_static(STR.as_ref())); } @@ -267,7 +267,7 @@ fn test_body_deflate() { assert!(response.status().is_success()); // read response - let bytes = srv.execute(response.body()).unwrap(); + let bytes = srv.block_on(response.body()).unwrap(); // decode deflate let mut e = ZlibDecoder::new(Vec::new()); @@ -294,7 +294,7 @@ fn test_body_brotli() { assert!(response.status().is_success()); // read response - let bytes = srv.execute(response.body()).unwrap(); + let bytes = srv.block_on(response.body()).unwrap(); // decode brotli let mut e = BrotliDecoder::new(Vec::with_capacity(2048)); @@ -327,11 +327,11 @@ fn test_body_brotli() { // .header(http::header::CONTENT_ENCODING, "gzip") // .body(enc.clone()) // .unwrap(); -// let response = srv.execute(request.send()).unwrap(); +// let response = srv.block_on(request.send()).unwrap(); // assert!(response.status().is_success()); // // read response -// let bytes = srv.execute(response.body()).unwrap(); +// let bytes = srv.block_on(response.body()).unwrap(); // assert_eq!(bytes, Bytes::from_static(STR.as_ref())); // } @@ -360,11 +360,11 @@ fn test_body_brotli() { // .header(http::header::CONTENT_ENCODING, "gzip") // .body(enc.clone()) // .unwrap(); -// let response = srv.execute(request.send()).unwrap(); +// let response = srv.block_on(request.send()).unwrap(); // assert!(response.status().is_success()); // // read response -// let bytes = srv.execute(response.body()).unwrap(); +// let bytes = srv.block_on(response.body()).unwrap(); // assert_eq!(bytes, Bytes::from(data)); // } @@ -397,11 +397,11 @@ fn test_body_brotli() { // .header(http::header::CONTENT_ENCODING, "gzip") // .body(enc.clone()) // .unwrap(); -// let response = srv.execute(request.send()).unwrap(); +// let response = srv.block_on(request.send()).unwrap(); // assert!(response.status().is_success()); // // read response -// let bytes = srv.execute(response.body()).unwrap(); +// let bytes = srv.block_on(response.body()).unwrap(); // assert_eq!(bytes.len(), data.len()); // assert_eq!(bytes, Bytes::from(data)); // } @@ -430,11 +430,11 @@ fn test_body_brotli() { // .header(http::header::CONTENT_ENCODING, "deflate") // .body(enc) // .unwrap(); -// let response = srv.execute(request.send()).unwrap(); +// let response = srv.block_on(request.send()).unwrap(); // assert!(response.status().is_success()); // // read response -// let bytes = srv.execute(response.body()).unwrap(); +// let bytes = srv.block_on(response.body()).unwrap(); // assert_eq!(bytes, Bytes::from_static(STR.as_ref())); // } @@ -463,11 +463,11 @@ fn test_body_brotli() { // .header(http::header::CONTENT_ENCODING, "deflate") // .body(enc) // .unwrap(); -// let response = srv.execute(request.send()).unwrap(); +// let response = srv.block_on(request.send()).unwrap(); // assert!(response.status().is_success()); // // read response -// let bytes = srv.execute(response.body()).unwrap(); +// let bytes = srv.block_on(response.body()).unwrap(); // assert_eq!(bytes, Bytes::from(data)); // } @@ -500,7 +500,7 @@ fn test_body_brotli() { // .header(http::header::CONTENT_ENCODING, "deflate") // .body(enc) // .unwrap(); -// let response = srv.execute(request.send()).unwrap(); +// let response = srv.block_on(request.send()).unwrap(); // assert!(response.status().is_success()); // // read response