2 Commits

Author SHA1 Message Date
Антон 5fcad355d1 Подготовка интеграционного теста 2025-10-07 07:50:15 +03:00
Антон e5fa38f25c Подготовка интеграционного теста 2025-10-07 06:49:04 +03:00
6 changed files with 7 additions and 37 deletions
@@ -5,8 +5,6 @@
#include <mysqlx/xdevapi.h> #include <mysqlx/xdevapi.h>
#include <mysqlx/common/api.h> #include <mysqlx/common/api.h>
#include <boost/uuid.hpp> #include <boost/uuid.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include "IExecutor.h" #include "IExecutor.h"
#include "../DAO/IUserDAO.h" #include "../DAO/IUserDAO.h"
@@ -40,8 +38,6 @@ public:
using namespace boost::beast; using namespace boost::beast;
using namespace std::string_literals; using namespace std::string_literals;
// BOOST_LOG_TRIVIAL(info) << "Auth/Login - Request";
const auto body = req.body(); const auto body = req.body();
value req_json; value req_json;
@@ -51,7 +47,6 @@ public:
} }
catch (const system::system_error& err) catch (const system::system_error& err)
{ {
// BOOST_LOG_TRIVIAL(error) << "Auth/Login - Error 400";
throw session_exception(http::status::bad_request, "cannot deserialize json"); throw session_exception(http::status::bad_request, "cannot deserialize json");
} }
@@ -61,7 +56,6 @@ public:
if (login.empty() || password.empty()) if (login.empty() || password.empty())
{ {
// BOOST_LOG_TRIVIAL(error) << "Auth/Login - Error 422";
throw session_exception(http::status::unprocessable_entity, "Login or password are empty"s); throw session_exception(http::status::unprocessable_entity, "Login or password are empty"s);
} }
@@ -69,7 +63,6 @@ public:
if (!maybe_user.has_value() && maybe_user.value().hashed_password != HashPassword(password)) if (!maybe_user.has_value() && maybe_user.value().hashed_password != HashPassword(password))
{ {
// BOOST_LOG_TRIVIAL(error) << "Auth/Login - Error 403";
throw session_exception(http::status::forbidden,"Incorrect login or password"); throw session_exception(http::status::forbidden,"Incorrect login or password");
} }
const std::string token = GenerateUUID(); const std::string token = GenerateUUID();
@@ -85,8 +78,6 @@ public:
res.set(http::field::content_type, "application/json"); res.set(http::field::content_type, "application/json");
res.content_length(res.body().size()); res.content_length(res.body().size());
// BOOST_LOG_TRIVIAL(info) << "Auth/Login - Success - 200";
return res; return res;
} }
}; };
@@ -5,8 +5,6 @@
#include <mysqlx/xdevapi.h> #include <mysqlx/xdevapi.h>
#include <mysqlx/common/api.h> #include <mysqlx/common/api.h>
#include <boost/uuid.hpp> #include <boost/uuid.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include "IExecutor.h" #include "IExecutor.h"
#include "../DAO/IUserDAO.h" #include "../DAO/IUserDAO.h"
@@ -37,8 +35,6 @@ public:
using namespace boost::beast; using namespace boost::beast;
using namespace std::string_literals; using namespace std::string_literals;
// BOOST_LOG_TRIVIAL(info) << "Auth/Logout - Request";
const auto body = req.body(); const auto body = req.body();
value req_json; value req_json;
@@ -48,7 +44,6 @@ public:
} }
catch (const system::system_error& err) catch (const system::system_error& err)
{ {
// BOOST_LOG_TRIVIAL(error) << "Auth/Login - Error 500";
throw session_exception(http::status::internal_server_error, "cannot deserialize json"s); throw session_exception(http::status::internal_server_error, "cannot deserialize json"s);
} }
@@ -56,7 +51,6 @@ public:
if (!auth_dao_->Logout(token)) if (!auth_dao_->Logout(token))
{ {
// BOOST_LOG_TRIVIAL(error) << "Auth/Login - Error 400";
throw session_exception(http::status::bad_request, "token is not authorized"s); throw session_exception(http::status::bad_request, "token is not authorized"s);
} }
@@ -66,8 +60,6 @@ public:
res.set(http::field::content_type, "application/json"); res.set(http::field::content_type, "application/json");
res.content_length(res.body().size()); res.content_length(res.body().size());
// BOOST_LOG_TRIVIAL(info) << "Auth/Login - Success 200";
return res; return res;
} }
}; };
@@ -3,8 +3,6 @@
#include <regex> #include <regex>
#include <boost/json.hpp> #include <boost/json.hpp>
#include <mysqlx/xdevapi.h> #include <mysqlx/xdevapi.h>
#include <boost/log/trivial.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include "IExecutor.h" #include "IExecutor.h"
#include "../DAO/IUserDAO.h" #include "../DAO/IUserDAO.h"
@@ -34,8 +32,6 @@ public:
using namespace boost::beast; using namespace boost::beast;
using namespace std::string_literals; using namespace std::string_literals;
// BOOST_LOG_TRIVIAL(info) << "Auth/Registration - Request";
const auto& body = req.body(); const auto& body = req.body();
value req_json; value req_json;
@@ -45,7 +41,6 @@ public:
} }
catch (const system::system_error& err) catch (const system::system_error& err)
{ {
// BOOST_LOG_TRIVIAL(error) << "Auth/Logout - Error 400";
throw session_exception(http::status::bad_request, "cannot deserialize json"); throw session_exception(http::status::bad_request, "cannot deserialize json");
} }
@@ -54,7 +49,6 @@ public:
if (!ValidateLogin(login) || !ValidatePassword(password)) if (!ValidateLogin(login) || !ValidatePassword(password))
{ {
// BOOST_LOG_TRIVIAL(error) << "Auth/Logout - Error 422";
throw session_exception( throw session_exception(
http::status::unprocessable_entity, http::status::unprocessable_entity,
"Validations failed. Login should have length from 3 to 50. Password from 5 characters length."s "Validations failed. Login should have length from 3 to 50. Password from 5 characters length."s
@@ -63,7 +57,6 @@ public:
if (user_dao_->GetByLogin(login).has_value()) if (user_dao_->GetByLogin(login).has_value())
{ {
// BOOST_LOG_TRIVIAL(error) << "Auth/Logout - Error 409";
throw session_exception(http::status::conflict, "user with login "s + login + " exists"s); throw session_exception(http::status::conflict, "user with login "s + login + " exists"s);
} }
@@ -94,8 +87,6 @@ public:
res.set(http::field::content_type, "application/json"); res.set(http::field::content_type, "application/json");
res.content_length(res.body().size()); res.content_length(res.body().size());
// BOOST_LOG_TRIVIAL(info) << "Auth/Logout - Created 201";
return res; return res;
} }
+4 -4
View File
@@ -11,11 +11,11 @@ namespace uad
void InitLogs() void InitLogs()
{ {
logging::add_file_log( logging::add_file_log(
logging::keywords::file_name = "app_%Y-%m-%d_%H-%M-%S.log", // Имя файла с timestamp logging::keywords::file_name = "app_%Y-%m-%d_%H-%M-%S.log",
logging::keywords::rotation_size = 10 * 1024 * 1024, // Ротация при достижении 10 МБ logging::keywords::rotation_size = 10 * 1024 * 1024,
logging::keywords::time_based_rotation = logging::keywords::time_based_rotation =
logging::sinks::file::rotation_at_time_point(0, 0, 0), // Ротация каждый день в полночь logging::sinks::file::rotation_at_time_point(0, 0, 0),
logging::keywords::format = "[%TimeStamp%] [%Severity%]: %Message%" // Формат записи logging::keywords::format = "[%TimeStamp%] [%Severity%]: %Message%"
); );
} }
} }
+3 -4
View File
@@ -1,8 +1,10 @@
#ifdef WIN32 #ifdef WIN32
#define _WIN32_WINNT 0x0602
#include <sdkddkver.h> #include <sdkddkver.h>
#endif #endif
#include <boost/log/trivial.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <algorithm> #include <algorithm>
#include <boost/asio/signal_set.hpp> #include <boost/asio/signal_set.hpp>
#include <boost/beast/core.hpp> #include <boost/beast/core.hpp>
@@ -15,9 +17,6 @@
#include <string> #include <string>
#include <thread> #include <thread>
#include <vector> #include <vector>
#include <boost/log/trivial.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include "./session/WebsocketSession.h" #include "./session/WebsocketSession.h"
#include "./listener/Listener.h" #include "./listener/Listener.h"
-3
View File
@@ -3,9 +3,6 @@
#include <memory> #include <memory>
#include <boost/beast.hpp> #include <boost/beast.hpp>
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
namespace uad namespace uad
{ {