diff --git a/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp b/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp index a18e04c..11b512d 100644 --- a/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp +++ b/tests/endpoint_handlers/AuthLogoutExecutor_TEST.cpp @@ -79,8 +79,6 @@ BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Cant_Revoke_Token) Request req; value req_body; - // auth_dao->Login("SomethingUser", "1234567890"); - req_body.emplace_object(); req_body.as_object().emplace("token", "1234567890"); @@ -96,3 +94,35 @@ BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Cant_Revoke_Token) mysql_session->close(); delete mysql_session; } + +BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Succesful_Auth) +{ + 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()); + + auto response = executor(std::move(req)); + + BOOST_CHECK(response.result() == http::status::ok); + + mysql_session->close(); + delete mysql_session; +}