generated from Sithas/conan_template
AuthRefistrationTest - 4 ok 0 fail
This commit is contained in:
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
#include "AuthFixture.h"
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/beast.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "./../../src/db/mysql_connector.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace uad
|
||||
{
|
||||
AuthFixture::AuthFixture() :
|
||||
uuid(std::to_string(uad::Random())),
|
||||
argv(boost::unit_test::framework::master_test_suite().argv),
|
||||
mysql_credentials(argv[1]),
|
||||
mysql_session(new mysqlx::Session(mysql_credentials)),
|
||||
helper(mysql_session),
|
||||
user_dao(std::make_shared<MySQLUserDAO>(GetMySqlSession())),
|
||||
auth_dao(make_shared<MemoryAuthDAO>(GetMySqlSession()))
|
||||
{
|
||||
BOOST_TEST_MESSAGE("Setup RouteAuthRegistrationExecutor fixture");
|
||||
}
|
||||
|
||||
AuthFixture::~AuthFixture()
|
||||
{
|
||||
argv = nullptr;
|
||||
mysql_session->close();
|
||||
delete mysql_session;
|
||||
mysql_session = nullptr;
|
||||
SetMySqlSession(nullptr);
|
||||
|
||||
BOOST_TEST_MESSAGE("Teardown RouteAuthRegistrationExecutor fixture");
|
||||
}
|
||||
}
|
||||
Vendored
+12
-18
@@ -17,30 +17,24 @@ namespace uad
|
||||
using Request = boost::beast::http::request<boost::beast::http::string_body,
|
||||
boost::beast::http::basic_fields<std::allocator<char>>>;
|
||||
|
||||
template <class Executor>
|
||||
class AuthFixture {
|
||||
class AuthFixture
|
||||
{
|
||||
public:
|
||||
const std::string uuid = std::to_string(uad::Random());
|
||||
char** argv = boost::unit_test::framework::master_test_suite().argv;
|
||||
const std::string uuid;
|
||||
char** argv;
|
||||
|
||||
const std::string mysql_credentials = argv[1];
|
||||
mysqlx::Session* mysql_session = new mysqlx::Session(mysql_credentials);
|
||||
const std::string mysql_credentials;
|
||||
mysqlx::Session* mysql_session;
|
||||
|
||||
fixture_session_initialization_helper helper = fixture_session_initialization_helper(mysql_session);
|
||||
fixture_session_initialization_helper helper;
|
||||
|
||||
std::shared_ptr<IUserDAO> user_dao = std::make_shared<MySQLUserDAO>(GetMySqlSession());
|
||||
std::shared_ptr<MemoryAuthDAO> auth_dao = std::make_shared<MemoryAuthDAO>(GetMySqlSession());
|
||||
Executor executor = Executor(GetMySqlSession(), user_dao);
|
||||
std::shared_ptr<IUserDAO> user_dao;
|
||||
std::shared_ptr<MemoryAuthDAO> auth_dao;
|
||||
|
||||
Request req;
|
||||
|
||||
AuthFixture()
|
||||
{
|
||||
BOOST_TEST_MESSAGE("Setup fixture");
|
||||
}
|
||||
~AuthFixture()
|
||||
{
|
||||
BOOST_TEST_MESSAGE("Teardown fixture");
|
||||
}
|
||||
AuthFixture();
|
||||
|
||||
~AuthFixture();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user