// Test the HTTP errors. extern crate chilli; extern crate hyper; use chilli::http_errors::NotFound; use hyper::header::ContentType; #[test] fn test_http_error_code() { let error = NotFound; assert!(error.code() == 404); } #[test] fn test_http_error_name() { let error = NotFound; assert!(error.name() == "Not Found"); } #[test] fn test_http_error_get_body() { let error = NotFound; assert!(error.get_body() == String::from( " 404 Not Found

Not Found

The requested URL was not found on the server. If you entered the \ URL manually please check your spelling and try again.

")); } #[test] fn test_http_error_to_response() { let error = NotFound; let response = error.to_response(); assert!(response.status_code == 404); assert!(*response.content_type().unwrap() == ContentType::html()); }