mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-06 10:11:31 +00:00
test
This commit is contained in:
1 parent
86a2d1dbc9
commit
a1a119276a
1 file changed
+14
+14
@@ -485,6 +485,20 @@ mod tests {
|
||||
assert_eq!(error.status_code(), StatusCode::PAYMENT_REQUIRED);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn too_many_requests_returns_429() {
|
||||
let error = CommonWebError::TooManyRequests;
|
||||
assert_eq!(error.status_code(), StatusCode::TOO_MANY_REQUESTS);
|
||||
assert!(!error.is_server_error());
|
||||
assert!(error.cause().is_none());
|
||||
|
||||
let response = error.error_response();
|
||||
let bytes = response.into_body().try_into_bytes().unwrap();
|
||||
let body = String::from_utf8(bytes.to_vec()).unwrap();
|
||||
assert!(body.contains("\"error_code\":429"));
|
||||
assert!(body.contains("\"error_code_str\":\"Too Many Requests\""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn uncaught_io_error_returns_500_and_hides_cause() {
|
||||
let io_err = std::io::Error::new(std::io::ErrorKind::Other, "disk exploded");
|
||||
|
||||
Reference in new issue
Block a user