summaryrefslogtreecommitdiff
path: root/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc')
-rw-r--r--src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc
index 7d40210ba4..ce51682f3c 100644
--- a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc
+++ b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc
@@ -65,32 +65,24 @@ class SQLPTExtRepresentationTest : public ::testing::Test {
SQLPTExtRepresentationTest() : reps_(NULL) {}
protected:
- SQLPTExtRepresentation* reps_;
+ std::shared_ptr<SQLPTExtRepresentation> reps_;
policy_handler_test::MockPolicySettings policy_settings_;
- static const string kDatabaseName;
PermissionConsent perm_consent;
FunctionalGroupPermission group1_perm;
FunctionalGroupPermission group2_perm;
- utils::dbms::SQLQuery* query_wrapper_;
- static const bool in_memory_;
- const std::string kAppStorageFolder = "storage_SQLPTExtRepresentationTest";
+ std::shared_ptr<utils::dbms::SQLQuery> query_wrapper_;
void SetUp() OVERRIDE {
- file_system::DeleteFile(kDatabaseName);
- reps_ = new SQLPTExtRepresentation(in_memory_);
+ reps_ = std::make_shared<SQLPTExtRepresentation>(true);
ASSERT_TRUE(reps_ != NULL);
- ON_CALL(policy_settings_, app_storage_folder())
- .WillByDefault(ReturnRef(kAppStorageFolder));
ASSERT_EQ(SUCCESS, reps_->Init(&policy_settings_));
- query_wrapper_ = new utils::dbms::SQLQuery(reps_->db());
+ query_wrapper_ = std::make_shared<utils::dbms::SQLQuery>(reps_->db());
ASSERT_TRUE(query_wrapper_ != NULL);
}
void TearDown() OVERRIDE {
- delete query_wrapper_;
EXPECT_TRUE(reps_->Drop());
EXPECT_TRUE(reps_->Close());
- delete reps_;
}
void FillGroupPermission(
@@ -261,9 +253,6 @@ SQLPTExtRepresentationTest::GetDataInternal(
return table.policy_table.functional_groupings;
}
-const string SQLPTExtRepresentationTest::kDatabaseName = ":memory:";
-const bool SQLPTExtRepresentationTest::in_memory_ = true;
-
::testing::AssertionResult IsValid(const policy_table::Table& table) {
if (table.is_valid()) {
return ::testing::AssertionSuccess();