Подготовка интеграционного теста

This commit is contained in:
Антон
2025-10-25 12:20:41 +03:00
parent 9a81fe7614
commit 2b6debdf25
@@ -94,6 +94,40 @@ BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Invalid_Login_Data)
delete mysql_session;
}
BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Invalid_Fields)
{
auto& argv = boost::unit_test::framework::master_test_suite().argv;
const std::string mysql_credentials = argv[1];
mysqlx::Session* mysql_session = new mysqlx::Session(mysql_credentials);
uad::SetMySqlSession(mysql_session);
auto user_dao = make_shared<MySQLUserDAO>(GetMySqlSession());
auto auth_dao = make_shared<MemoryAuthDAO>(GetMySqlSession());
auto executor = RouteAuthLoginExecutor(GetMySqlSession(), user_dao, auth_dao);
Request req;
value req_body;
req_body.emplace_object();
req_body.as_object().emplace("login"s, ""s);
req_body.as_object().emplace("password"s, ""s);
req.body() = serialize(req_body);
BOOST_CHECK_EXCEPTION(executor(std::move(req)), session_exception,
[](const session_exception& e) -> bool
{
return e.code == beast::http::status::unprocessable_entity;
});
mysql_session->close();
delete mysql_session;
}
BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Succesful_Login)
{
auto& argv = boost::unit_test::framework::master_test_suite().argv;