diff --git a/README.md b/README.md index da3171e..26610a6 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,8 @@ - UseCase'ы по работе с личным кабинетом - Научиться поднимать базы данных под каждый тест - научиться Docker - docker-compose - а если тест что-то должен заполнить, то он заполняет в самом начале() - Возможно, сделать тесты на CI/CD - приоритет - низкий -- Заменить internal_server_error на bad_request и перепроверить коды ошибок -- Создание и удаление вспомогательных классов должно быть вынесено в фикстуру +- ~~Заменить internal_server_error на bad_request и перепроверить коды ошибок~~ +- ~~Создание и удаление вспомогательных классов должно быть вынесено в фикстуру~~ # UseCase'ы приложения: diff --git a/src/endpoints_handlers/AuthLoginExecutor.h b/src/endpoints_handlers/AuthLoginExecutor.h index d49e35e..47eef99 100644 --- a/src/endpoints_handlers/AuthLoginExecutor.h +++ b/src/endpoints_handlers/AuthLoginExecutor.h @@ -50,8 +50,8 @@ public: } catch (const system::system_error& err) { - BOOST_LOG_TRIVIAL(info) << "POST /api/v1/Auth/Login - Response 500: Cannot deserialize json"; - throw session_exception(http::status::internal_server_error, "Cannot deserialize json"); + BOOST_LOG_TRIVIAL(info) << "POST /api/v1/Auth/Login - Response 400: Cannot deserialize json"; + throw session_exception(http::status::bad_request, "Cannot deserialize json"); } diff --git a/src/endpoints_handlers/AuthLogoutExecutor.h b/src/endpoints_handlers/AuthLogoutExecutor.h index 152ce60..b78c2f9 100644 --- a/src/endpoints_handlers/AuthLogoutExecutor.h +++ b/src/endpoints_handlers/AuthLogoutExecutor.h @@ -43,8 +43,8 @@ public: } catch (const system::system_error& err) { - BOOST_LOG_TRIVIAL(error) << "POST /api/v1/Auth/Logout - Response 500: Cannot deserialize json"; - throw session_exception(http::status::internal_server_error, "cannot deserialize json"s); + BOOST_LOG_TRIVIAL(error) << "POST /api/v1/Auth/Logout - Response 400: Cannot deserialize json"; + throw session_exception(http::status::bad_request, "cannot deserialize json"s); } const std::string token = req_json.as_object().at("token").as_string().c_str(); diff --git a/src/endpoints_handlers/AuthRegistrationExecutor.h b/src/endpoints_handlers/AuthRegistrationExecutor.h index f659856..0153454 100644 --- a/src/endpoints_handlers/AuthRegistrationExecutor.h +++ b/src/endpoints_handlers/AuthRegistrationExecutor.h @@ -44,8 +44,8 @@ public: } catch (const system::system_error& err) { - BOOST_LOG_TRIVIAL(error) << "POST /api/v1/Auth/Registration - Response 500: Cannot deserialize json"; - throw session_exception(http::status::internal_server_error, "Cannot deserialize json"); + BOOST_LOG_TRIVIAL(error) << "POST /api/v1/Auth/Registration - Response 400: Cannot deserialize json"; + throw session_exception(http::status::bad_request, "Cannot deserialize json"); } const std::string login = req_json.as_object().at("login").as_string().c_str(); diff --git a/tests/endpoint_handlers/AuthLoginExecutor_TEST.cpp b/tests/endpoint_handlers/AuthLoginExecutor_TEST.cpp index bed4ef2..560ac7b 100644 --- a/tests/endpoint_handlers/AuthLoginExecutor_TEST.cpp +++ b/tests/endpoint_handlers/AuthLoginExecutor_TEST.cpp @@ -54,7 +54,7 @@ BOOST_FIXTURE_TEST_CASE(AuthRegistrationExecutor_Cannot_Serialize_JSON, AuthFixt BOOST_CHECK_EXCEPTION(executor(std::move(req)), session_exception, [](const session_exception& e) -> bool { - return e.code == beast::http::status::internal_server_error; + return e.code == beast::http::status::bad_request; }); mysql_session->close(); diff --git a/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp b/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp index e1c958a..2a3d7b9 100644 --- a/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp +++ b/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp @@ -57,7 +57,7 @@ BOOST_FIXTURE_TEST_CASE(AuthRegistrationExecutor_Cant_Find_User_Token, AuthFixtu BOOST_CHECK_EXCEPTION(executor(std::move(req)), session_exception, [](const session_exception& e) -> bool { - return e.code == beast::http::status::internal_server_error; + return e.code == beast::http::status::bad_request; }); mysql_session->close(); diff --git a/tests/endpoint_handlers/AuthRegistrationExecutor_TEST.cpp b/tests/endpoint_handlers/AuthRegistrationExecutor_TEST.cpp index bc2e6ea..b916bc2 100644 --- a/tests/endpoint_handlers/AuthRegistrationExecutor_TEST.cpp +++ b/tests/endpoint_handlers/AuthRegistrationExecutor_TEST.cpp @@ -35,7 +35,7 @@ BOOST_FIXTURE_TEST_CASE(AuthRegistrationExecutor_Failed_Parse_Payload, AuthFixtu BOOST_CHECK_EXCEPTION(executor(std::move(req)), session_exception, [](const session_exception& e) -> bool { - return e.code == beast::http::status::internal_server_error; + return e.code == beast::http::status::bad_request; }); }