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

This commit is contained in:
Антон
2025-10-26 12:58:50 +03:00
parent f57fddb2af
commit e6708988ff
@@ -62,3 +62,37 @@ BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Cant_Find_User_Token)
mysql_session->close();
delete mysql_session;
}
BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Cant_Revoke_Token)
{
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 auth_dao = make_shared<MemoryAuthDAO>(GetMySqlSession());
auto executor = RouteAuthLogoutExecutor(GetMySqlSession(), auth_dao);
Request req;
value req_body;
// auth_dao->Login("SomethingUser", "1234567890");
req_body.emplace_object();
req_body.as_object().emplace("token", "1234567890");
req.body() = "{ \"token\": \"1234567890\" }";
req.content_length(req.body().size());
BOOST_CHECK_EXCEPTION(executor(std::move(req)), session_exception,
[](const session_exception& e) -> bool
{
return e.code == beast::http::status::bad_request;
});
mysql_session->close();
delete mysql_session;
}