Remove ugly manual setup of pkgmgr database
[platform/core/test/security-tests.git] / src / common / sm_api.cpp
index bc70ea0..dd1af2c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2019 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014-2020 Samsung Electronics Co., Ltd. All rights reserved
  *
  *    Licensed under the Apache License, Version 2.0 (the "License");
  *    you may not use this file except in compliance with the License.
@@ -27,35 +27,13 @@ namespace Api {
 
 void install(const InstallRequest &request, lib_retcode expectedResult)
 {
-    uid_t uid = getuid();
-    std::string dbPath = uid == 0 ? "/opt/dbspace/" : "/opt/dbspace/user/" + std::to_string(uid) + "/";
-
-    std::ostringstream command;
-    command << "/usr/bin/sqlite3 "
-            << dbPath << ".pkgmgr_parser.db "
-            << " \"insert into package_info (package, package_type, package_api_version,"
-            << " install_location, mainapp_id, root_path, installed_storage)"
-            << " values ('" << request.getPkgId() << "', 'tpk', '" << request.getAppTizenVersion()
-            << "', 'auto', '" << request.getPkgId() << "', '/opt/usr/globallapps/"
-            << request.getPkgId() << "', 'installed_internal')\"";
-    int pkgmgrResult = system(command.str().c_str());
-    RUNNER_ASSERT_MSG(pkgmgrResult == 0, "failed to set package_info: " << pkgmgrResult);
-
     int result = security_manager_app_install(request.get());
 
-    command = std::ostringstream();
-    command << "/usr/bin/sqlite3 "
-            << dbPath << ".pkgmgr_parser.db "
-            << " \"delete from package_info where package='" << request.getPkgId() << "'\"";
-    pkgmgrResult = system(command.str().c_str());
-
     RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult,
                       "installing app returned wrong value."
                       << " InstallRequest: [ " << request << "];"
                       << " Result: " << result << ";"
                       << " Expected result: " << expectedResult);
-
-    RUNNER_ASSERT_MSG(pkgmgrResult == 0, "failed to unset package_info: " << pkgmgrResult);
 }
 
 void update(const InstallRequest &request, lib_retcode expectedResult)