From 775665684a709477711b5aceb660980af45601e7 Mon Sep 17 00:00:00 2001 From: Jan Cybulski Date: Tue, 16 Dec 2014 13:49:05 +0100 Subject: [PATCH] Test for installing app to two separate packages Security-manager should return error code in such situation Change-Id: I1fd85b75bc20763c1124543b7a64314db4bb7b44 Signed-off-by: Jan Cybulski --- .../security_manager_tests.cpp | 39 ++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/tests/security-manager-tests/security_manager_tests.cpp b/tests/security-manager-tests/security_manager_tests.cpp index cf5f7a8..1b7a11c 100644 --- a/tests/security-manager-tests/security_manager_tests.cpp +++ b/tests/security-manager-tests/security_manager_tests.cpp @@ -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"; -- 2.7.4