Lines
100 %
Functions
Branches
use super::*;
#[test]
fn a_busy_form_submit_is_a_409_with_the_conflict_message() {
let message = "The data changed while saving; try again";
let err = failure_error(
"Transaction edit failed",
Failure::Internal(rpc::host_failure::busy_condition(message)),
);
assert_eq!(err, WebError::new(StatusCode::CONFLICT, message));
}
fn a_form_submit_on_a_deleted_entity_is_a_404() {
let message = "Transaction not found";
Failure::Internal(rpc::host_failure::not_found_condition(message, None)),
assert_eq!(err, WebError::not_found(message));
fn a_form_native_condition_answers_with_its_own_status() {
let args = failure_error(
"Tag set failed",
Failure::Internal(rpc::natives::forms::args_error("blank tag")),
assert_eq!(args, WebError::bad_request("blank tag"));
fn a_form_submit_on_an_unreachable_database_is_a_503_not_an_internal_error() {
let message = "No connection-pool slot became free in time";
"Transaction create failed",
Failure::Internal(rpc::host_failure::unavailable_condition(message)),
assert_eq!(
err,
WebError::unavailable("The service is temporarily unavailable")
fn a_form_submit_fault_is_logged_once_by_the_web_edge() {
let captured = server::log_capture::Captured::default();
let _logs = tracing::subscriber::set_default(captured.subscriber());
Failure::Internal(std::io::Error::other("DATABASE_URL is not provided").into()),
assert_eq!(err.status, StatusCode::INTERNAL_SERVER_ERROR);
assert_eq!(captured.error_lines(), 1);