Skip to content
Snippets Groups Projects
Commit 10bc63c2 authored by Daniel Hornung's avatar Daniel Hornung
Browse files

ENH: Tests now also clean before tests.

parent 5b6d1470
No related branches found
No related tags found
No related merge requests found
Pipeline #12625 passed
...@@ -39,6 +39,7 @@ protected: ...@@ -39,6 +39,7 @@ protected:
fs::path test_download_file_1; fs::path test_download_file_1;
void SetUp() override { void SetUp() override {
DeleteEntities();
test_upload_file_1 = fs::path("test_upload_file_1_delete_me.dat"); test_upload_file_1 = fs::path("test_upload_file_1_delete_me.dat");
test_download_file_1 = fs::path("test_download_file_1_delete_me.dat"); test_download_file_1 = fs::path("test_download_file_1_delete_me.dat");
...@@ -50,14 +51,18 @@ protected: ...@@ -50,14 +51,18 @@ protected:
} }
} }
/**
* Delete everything with id>99, C style
*/
void TearDown() override { void TearDown() override {
// delete files // delete files
fs::remove(test_upload_file_1); fs::remove(test_upload_file_1);
fs::remove(test_download_file_1); fs::remove(test_download_file_1);
DeleteEntities();
}
/**
* Delete everything with id>99, C style
*/
static void DeleteEntities() {
caosdb_connection_connection connection; caosdb_connection_connection connection;
caosdb_connection_connection_manager_get_default_connection(&connection); caosdb_connection_connection_manager_get_default_connection(&connection);
......
...@@ -36,9 +36,11 @@ namespace caosdb::entity { ...@@ -36,9 +36,11 @@ namespace caosdb::entity {
class test_list_properties : public ::testing::Test { class test_list_properties : public ::testing::Test {
protected: protected:
void SetUp() override {} void SetUp() override { DeleteEntities(); }
void TearDown() override { void TearDown() override { DeleteEntities(); }
static void DeleteEntities() {
const auto &connection = const auto &connection =
caosdb::connection::ConnectionManager::GetDefaultConnection(); caosdb::connection::ConnectionManager::GetDefaultConnection();
auto query_transaction(connection->CreateTransaction()); auto query_transaction(connection->CreateTransaction());
......
...@@ -54,6 +54,8 @@ protected: ...@@ -54,6 +54,8 @@ protected:
fs::path test_download_file_1; fs::path test_download_file_1;
void SetUp() override { void SetUp() override {
DeleteEntities();
test_upload_file_1 = fs::path("test_upload_file_1_delete_me.dat"); test_upload_file_1 = fs::path("test_upload_file_1_delete_me.dat");
test_download_file_1 = fs::path("test_download_file_1_delete_me.dat"); test_download_file_1 = fs::path("test_download_file_1_delete_me.dat");
...@@ -69,7 +71,10 @@ protected: ...@@ -69,7 +71,10 @@ protected:
// delete files // delete files
fs::remove(test_upload_file_1); fs::remove(test_upload_file_1);
fs::remove(test_download_file_1); fs::remove(test_download_file_1);
DeleteEntities();
}
static void DeleteEntities() {
// delete all entities // delete all entities
const auto &connection = const auto &connection =
caosdb::connection::ConnectionManager::GetDefaultConnection(); caosdb::connection::ConnectionManager::GetDefaultConnection();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment