fixed backend tests
This commit is contained in:
@@ -8,13 +8,19 @@ using namespace matador::sql;
|
||||
|
||||
TEST_CASE("Create connection test", "[connection]") {
|
||||
const connection c(matador::test::connection::dns);
|
||||
REQUIRE(!c.is_open());
|
||||
auto res = c.is_open();
|
||||
REQUIRE(res);
|
||||
REQUIRE(!*res);
|
||||
|
||||
auto result = c.open();
|
||||
REQUIRE(result.is_ok());
|
||||
REQUIRE(c.is_open());
|
||||
res = c.is_open();
|
||||
REQUIRE(res);
|
||||
REQUIRE(*res);
|
||||
|
||||
result = c.close();
|
||||
REQUIRE(result.is_ok());
|
||||
REQUIRE(!c.is_open());
|
||||
res = c.is_open();
|
||||
REQUIRE(res);
|
||||
REQUIRE(!*res);
|
||||
}
|
||||
|
||||
@@ -37,15 +37,13 @@ void QueryFixture::check_table_not_exists(const std::string &table_name) const
|
||||
}
|
||||
|
||||
void QueryFixture::drop_table_if_exists(const std::string &table_name) const {
|
||||
const auto result = db.exists(table_name).and_then([&table_name, this](bool exists) {
|
||||
const auto result = db.exists(table_name).and_then([&table_name, this](const bool exists) {
|
||||
if (exists) {
|
||||
if (query::query::drop()
|
||||
.table(table_name)
|
||||
.execute(db).is_ok()) {
|
||||
this->check_table_not_exists(table_name);
|
||||
} else {
|
||||
FAIL("Failed to drop table");
|
||||
}
|
||||
auto res = query::query::drop()
|
||||
.table(table_name)
|
||||
.execute(db);
|
||||
REQUIRE(res);
|
||||
this->check_table_not_exists(table_name);
|
||||
}
|
||||
return utils::ok(true);
|
||||
});
|
||||
|
||||
@@ -476,8 +476,7 @@ TEST_CASE_METHOD(QueryFixture, "Execute select statement with group by and order
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(QueryFixture, "Execute delete statement", "[query][record]")
|
||||
{
|
||||
TEST_CASE_METHOD(QueryFixture, "Execute delete statement", "[query][record]") {
|
||||
auto res = query::create()
|
||||
.table("person", {
|
||||
make_pk_column<uint32_t>("id"),
|
||||
|
||||
@@ -20,7 +20,7 @@ public:
|
||||
~StatementCacheFixture() = default;
|
||||
|
||||
protected:
|
||||
sql::connection_pool<matador::sql::connection> pool;
|
||||
sql::connection_pool<sql::connection> pool;
|
||||
orm::session ses;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user