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:
parent
6ad048d445
commit
71f7606baf
2 changed files with 19 additions and 3 deletions
13
src/error.rs
13
src/error.rs
|
@ -149,9 +149,9 @@ mod tests {
|
|||
use std::error::Error as StdError;
|
||||
use std::io;
|
||||
use httparse;
|
||||
use http::StatusCode;
|
||||
use http::{StatusCode, Error as HttpError};
|
||||
use cookie::ParseError as CookieParseError;
|
||||
use super::{ParseError, HttpResponse, HttpRangeParseError};
|
||||
use super::{ParseError, HttpResponse, HttpRangeParseError, MultipartError};
|
||||
|
||||
#[test]
|
||||
fn test_into_response() {
|
||||
|
@ -163,7 +163,14 @@ mod tests {
|
|||
|
||||
let resp: HttpResponse = CookieParseError::EmptyName.into();
|
||||
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]
|
||||
fn test_cause() {
|
||||
|
|
|
@ -708,6 +708,15 @@ fn test_boundary() {
|
|||
_ => 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();
|
||||
headers.insert(
|
||||
header::CONTENT_TYPE,
|
||||
|
|
Loading…
Reference in a new issue