Fix security_manager_11_security_manager_cmd_install
[platform/core/test/security-tests.git] / tests / security-manager-tests / security_manager_tests.cpp
index d7faca8..6ab415e 100644 (file)
@@ -815,15 +815,17 @@ RUNNER_CHILD_TEST(security_manager_06_install_app_offline)
 {
     const char *const app_id = "sm_test_06_app_id_install_app_offline";
     const char *const pkg_id = "sm_test_06_pkg_id_install_app_offline";
-    ServiceManager serviceManager("security-manager.service");
 
+    // Uninstall app on-line, off-line mode doesn't support it
     uninstall_app(app_id, pkg_id, true);
-    serviceManager.maskService();
+
+    ServiceManager("security-manager.service").stopService();
+
+    ServiceManager serviceManager("security-manager.socket");
     serviceManager.stopService();
 
     install_app(app_id, pkg_id);
 
-    serviceManager.unmaskService();
     serviceManager.startService();
 
     uninstall_app(app_id, pkg_id, true);
@@ -897,8 +899,10 @@ RUNNER_CHILD_TEST(security_manager_09_add_user_offline)
     const char *const app_id = "security_manager_09_add_user_offline_app";
     const char *const pkg_id = "security_manager_09_add_user_offline_pkg";
     const std::string new_user_name("sm_test_09_user_name");
-    ServiceManager serviceManager("security-manager.service");
-    serviceManager.maskService();
+
+    ServiceManager("security-manager.service").stopService();
+
+    ServiceManager serviceManager("security-manager.socket");
     serviceManager.stopService();
 
     TemporaryTestUser test_user(new_user_name, GUM_USERTYPE_NORMAL, true);
@@ -911,7 +915,6 @@ RUNNER_CHILD_TEST(security_manager_09_add_user_offline)
 
     check_app_after_install(app_id, pkg_id);
 
-    serviceManager.unmaskService();
     serviceManager.startService();
 
     test_user.remove();
@@ -2107,14 +2110,14 @@ RUNNER_CHILD_TEST(security_manager_11_security_manager_cmd_install)
     TemporaryTestUser user(username, GUM_USERTYPE_NORMAL, true);
     user.create();
     user.getUidString(uid_string);
-    const std::string path1 = "/home/" + username + "/p1";
-    const std::string path2 = "/home/" + username + "/p2";
+    const std::string path1 = appDirPath(user, app_id, pkg_id) + "/p1";
+    const std::string path2 = appDirPath(user, app_id, pkg_id) + "/p2";
     const std::string pkgopt = " --pkg=" + pkg_id;
     const std::string appopt = " --app=" + app_id;
     const std::string uidopt = " --uid=" + uid_string;
 
-    mkdir(path1.c_str(), 0);
-    mkdir(path2.c_str(), 0);
+    mktreeSafe(path1.c_str(), 0);
+    mktreeSafe(path2.c_str(), 0);
 
     const std::string installcmd = "security-manager-cmd --install " + appopt + pkgopt + uidopt;
 
@@ -2131,11 +2134,11 @@ RUNNER_CHILD_TEST(security_manager_11_security_manager_cmd_install)
             {"security-manager-cmd --i --app=app_id_10 --pkg=pkg_id_10", FAILURE},//no uid
             {installcmd, SUCCESS},
             {"security-manager-cmd -i -a" + app_id + " -g" + pkg_id + uidopt, SUCCESS},
-            {installcmd + " --path " + path1 + " private", SUCCESS},
+            {installcmd + " --path " + path1 + " writable", SUCCESS},
             {installcmd + " --path " + path1, FAILURE},//no path type
-            {installcmd + " --path " + path1 + " private" + " --path " + path2 + " private", SUCCESS},
-            {installcmd + " --path " + path1 + " prie" + " --path " + path2 + " public", FAILURE},//wrong path type
-            {installcmd + " --path " + path1 + " private" + " --privilege somepriv --privilege somepriv2" , SUCCESS},
+            {installcmd + " --path " + path1 + " writable" + " --path " + path2 + " readable", SUCCESS},
+            {installcmd + " --path " + path1 + " prie" + " --path " + path2 + " readable", FAILURE},//wrong path type
+            {installcmd + " --path " + path1 + " writable" + " --privilege somepriv --privilege somepriv2" , SUCCESS},
     };
 
     for (auto &op : operations) {