Test for installing app to two separate packages 38/31338/10
authorJan Cybulski <j.cybulski@samsung.com>
Tue, 16 Dec 2014 12:49:05 +0000 (13:49 +0100)
committerJan Cybulski <j.cybulski@samsung.com>
Wed, 17 Dec 2014 06:57:06 +0000 (07:57 +0100)
Security-manager should return error code in such situation

Change-Id: I1fd85b75bc20763c1124543b7a64314db4bb7b44
Signed-off-by: Jan Cybulski <j.cybulski@samsung.com>
tests/security-manager-tests/security_manager_tests.cpp

index cf5f7a8..1b7a11c 100644 (file)
@@ -276,10 +276,10 @@ static void uninstall_app(const char *app_id, const char *pkg_id, bool expect_pk
 RUNNER_TEST_GROUP_INIT(SECURITY_MANAGER)
 
 
-RUNNER_TEST(security_manager_01_app_double_install_double_uninstall)
+RUNNER_TEST(security_manager_01a_app_double_install_double_uninstall)
 {
-    const char *const sm_app_id = "sm_test_01_app_id_double";
-    const char *const sm_pkg_id = "sm_test_01_pkg_id_double";
+    const char *const sm_app_id = "sm_test_01a_app_id_double";
+    const char *const sm_pkg_id = "sm_test_01a_pkg_id_double";
 
     InstallRequest requestInst;
     requestInst.setAppId(sm_app_id);
@@ -301,6 +301,39 @@ RUNNER_TEST(security_manager_01_app_double_install_double_uninstall)
     check_app_after_uninstall(sm_app_id, sm_pkg_id, TestSecurityManagerDatabase::REMOVED);
 }
 
+
+RUNNER_TEST(security_manager_01b_app_double_install_wrong_pkg_id)
+{
+    const char *const sm_app_id = "sm_test_01b_app";
+    const char *const sm_pkg_id = "sm_test_01b_pkg";
+    const char *const sm_pkg_id_wrong = "sm_test_01b_pkg_BAD";
+
+    InstallRequest requestInst;
+    requestInst.setAppId(sm_app_id);
+    requestInst.setPkgId(sm_pkg_id);
+
+    Api::install(requestInst);
+
+    InstallRequest requestInst2;
+    requestInst2.setAppId(sm_app_id);
+    requestInst2.setPkgId(sm_pkg_id_wrong);
+
+    Api::install(requestInst2, SECURITY_MANAGER_ERROR_INPUT_PARAM);
+
+
+    /* Check records in the security-manager database */
+    check_app_after_install(sm_app_id, sm_pkg_id);
+
+    InstallRequest requestUninst;
+    requestUninst.setAppId(sm_app_id);
+
+    Api::uninstall(requestUninst);
+
+
+    /* Check records in the security-manager database */
+    check_app_after_uninstall(sm_app_id, sm_pkg_id, TestSecurityManagerDatabase::REMOVED);
+
+}
 RUNNER_TEST(security_manager_02_app_install_uninstall_full)
 {
     const char *const sm_app_id = "sm_test_02_app_id_full";