From e6708988ffa31f2e14ac5f89a71f5eafe3487072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD?= Date: Sun, 26 Oct 2025 12:58:50 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=B8=D0=BD=D1=82=D0=B5=D0=B3=D1=80=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=BE=D0=BD=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=82=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AuthLogoutExecutor_TEST.cpp | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp b/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp index 75b3b75..a18e04c 100644 --- a/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp +++ b/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp @@ -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(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; +}