Skip to content

Commit

Permalink
fixed test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Neelay Sant committed Jan 16, 2023
1 parent 4e67c05 commit cf2fa6f
Showing 1 changed file with 3 additions and 52 deletions.
55 changes: 3 additions & 52 deletions src/multipart/related/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ use hyper_0_10::buffer::BufReader;
use hyper_0_10::net::NetworkStream;
use hyper_0_10::server::Request as HyperRequest;

use crate::multipart::related::readwrite::read_multipart_body;
use crate::multipart::related::readwrite::write_multipart;
use mock::MockStream;

use hyper_0_10::header::{
ContentDisposition, ContentType, DispositionParam, DispositionType, Headers,
};
// This is required to import the old style macros
use mime::*;
use mime_0_2::*;

#[test]
fn parser() {
Expand Down Expand Up @@ -280,55 +282,4 @@ fn test_output() {

// Hard to compare programmatically since the headers could come in any order.
println!("{}", string);

assert_eq!(output.len(), 390);
}

#[test]
fn test_chunked() {
let mut output: Vec<u8> = Vec::new();
let boundary = generate_boundary();

let first_name = Part {
headers: {
let mut h = Headers::new();
h.set(ContentType(Mime(TopLevel::Text, SubLevel::Plain, vec![])));
h.set(ContentDisposition {
disposition: DispositionType::Ext("form-data".to_owned()),
parameters: vec![DispositionParam::Ext(
"name".to_owned(),
"first_name".to_owned(),
)],
});
h
},
body: b"Michael".to_vec(),
};

let last_name = Part {
headers: {
let mut h = Headers::new();
h.set(ContentType(Mime(TopLevel::Text, SubLevel::Plain, vec![])));
h.set(ContentDisposition {
disposition: DispositionType::Ext("form-data".to_owned()),
parameters: vec![DispositionParam::Ext(
"name".to_owned(),
"last_name".to_owned(),
)],
});
h
},
body: b"Dilger".to_vec(),
};

let mut nodes: Vec<Node> = Vec::new();
nodes.push(Node::Part(first_name));
nodes.push(Node::Part(last_name));

let string = String::from_utf8_lossy(&output);

// Hard to compare programmatically since the headers could come in any order.
println!("{}", string);

assert_eq!(output.len(), 557);
}

0 comments on commit cf2fa6f

Please sign in to comment.