mod common;
use apollo_errors::Error as ErrorTrait;
use common::{ErrorWithStatus, SimpleError};
use http::StatusCode;
#[test]
fn test_default_status_500() {
let error = SimpleError::Simple;
assert_eq!(error.http_status(), StatusCode::INTERNAL_SERVER_ERROR);
}
#[test]
fn test_internal_error_default_500() {
let error = ErrorWithStatus::InternalError;
assert_eq!(error.http_status(), StatusCode::INTERNAL_SERVER_ERROR);
}
#[test]
fn test_not_found_404() {
let error = ErrorWithStatus::NotFound;
assert_eq!(error.http_status(), StatusCode::NOT_FOUND);
}
#[test]
fn test_bad_request_400() {
let error = ErrorWithStatus::BadRequest;
assert_eq!(error.http_status(), StatusCode::BAD_REQUEST);
}
#[test]
fn test_service_unavailable_503() {
let error = ErrorWithStatus::ServiceUnavailable;
assert_eq!(error.http_status(), StatusCode::SERVICE_UNAVAILABLE);
}