1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-24 00:50:36 +00:00

more tests

This commit is contained in:
Nikolay Kim 2017-10-22 09:45:53 -07:00
parent 6ad048d445
commit 71f7606baf
2 changed files with 19 additions and 3 deletions

View file

@ -149,9 +149,9 @@ mod tests {
use std::error::Error as StdError; use std::error::Error as StdError;
use std::io; use std::io;
use httparse; use httparse;
use http::StatusCode; use http::{StatusCode, Error as HttpError};
use cookie::ParseError as CookieParseError; use cookie::ParseError as CookieParseError;
use super::{ParseError, HttpResponse, HttpRangeParseError}; use super::{ParseError, HttpResponse, HttpRangeParseError, MultipartError};
#[test] #[test]
fn test_into_response() { fn test_into_response() {
@ -163,7 +163,14 @@ mod tests {
let resp: HttpResponse = CookieParseError::EmptyName.into(); let resp: HttpResponse = CookieParseError::EmptyName.into();
assert_eq!(resp.status(), StatusCode::BAD_REQUEST); assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
}
let resp: HttpResponse = MultipartError::Boundary.into();
assert_eq!(resp.status(), StatusCode::BAD_REQUEST);
let err: HttpError = StatusCode::from_u16(10000).err().unwrap().into();
let resp: HttpResponse = err.into();
assert_eq!(resp.status(), StatusCode::INTERNAL_SERVER_ERROR);
}
#[test] #[test]
fn test_cause() { fn test_cause() {

View file

@ -708,6 +708,15 @@ fn test_boundary() {
_ => panic!("should not happen"), _ => panic!("should not happen"),
} }
let mut headers = HeaderMap::new();
headers.insert(
header::CONTENT_TYPE,
header::HeaderValue::from_static("multipart/mixed"));
match Multipart::boundary(&headers) {
Err(MultipartError::Boundary) => (),
_ => panic!("should not happen"),
}
let mut headers = HeaderMap::new(); let mut headers = HeaderMap::new();
headers.insert( headers.insert(
header::CONTENT_TYPE, header::CONTENT_TYPE,