blob: 9906a0b8a11419d8ff17490ca3fcc884f88db61b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#define BOOST_TEST_MODULE EndToEnd
#include <boost/test/data/test_case.hpp>
#include <boost/test/unit_test.hpp>
#include "testdb-mysql.h"
#include "testdb-postgresql.h"
#include <output/pq/updateDatabase.h>
#include <sql/createTestTable.h>
#include <sql/selectTestTable.h>
BOOST_AUTO_TEST_CASE(e2e)
{
const char * const target_schema {"testout"};
using namespace MyGrate::Testing;
MySQLDB my;
PqConnDB pq {ROOT "/db/schema.sql"};
auto pqm = pq.mock();
auto mym = my.mock();
auto out = MyGrate::Output::Pq::UpdateDatabase::createNew(&pqm, MySQLDB::SERVER, MySQLDB::USER, MySQLDB::PASSWORD,
MySQLDB::PORT, my.mockname.c_str(), 100, target_schema);
BOOST_CHECK_EQUAL(out.source, 1);
auto src = out.getSource();
BOOST_REQUIRE(src);
MyGrate::sql::createTestTable::execute(&mym);
out.addTable(&mym, "session");
BOOST_CHECK_EQUAL(MyGrate::sql::selectTestTable::execute(&pqm)->rows(), 0);
}
|