generated from Sithas/conan_template
Подготовка интеграционного теста
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
using namespace std;
|
||||
using namespace uad;
|
||||
using namespace boost;
|
||||
using namespace json;
|
||||
|
||||
using RouteAuthRegistrationExecutor = AuthRegistrationExecutor<beast::http::string_body,
|
||||
std::allocator<char>,
|
||||
@@ -21,9 +22,8 @@ using RouteAuthRegistrationExecutor = AuthRegistrationExecutor<beast::http::stri
|
||||
using Request = boost::beast::http::request<beast::http::string_body,
|
||||
beast::http::basic_fields<std::allocator<char>>>;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Succesful_Login)
|
||||
BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Failed_Parse_Payload)
|
||||
{
|
||||
auto& args = boost::unit_test::framework::master_test_suite().argc;
|
||||
auto& argv = boost::unit_test::framework::master_test_suite().argv;
|
||||
|
||||
const std::string mysql_credentials = argv[1];
|
||||
@@ -44,7 +44,37 @@ BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Succesful_Login)
|
||||
return e.code == beast::http::status::internal_server_error;
|
||||
});
|
||||
|
||||
BOOST_CHECK(true == true);
|
||||
mysql_session->close();
|
||||
delete mysql_session;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(AuthRegistrationExecutor_Invalid_Login_Data)
|
||||
{
|
||||
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 executor = RouteAuthRegistrationExecutor(GetMySqlSession(), user_dao);
|
||||
|
||||
Request req;
|
||||
value req_body;
|
||||
|
||||
req_body.emplace_object();
|
||||
|
||||
req_body.as_object().emplace("login"s, "wq");
|
||||
req_body.as_object().emplace("password"s, "Qw");
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user