const privileges_t &allowed_privs, const privileges_t &denied_privs,
const rules_t &allowed_rules, const rules_t &denied_rules)
{
+ TestSecurityManagerDatabase dbtest;
+ dbtest.test_db_after__app_install(app_id, pkg_id, allowed_privs);
+ dbtest.check_privileges_removed(app_id, pkg_id, denied_privs);
+
check_app_permissions(app_id, pkg_id,
allowed_privs, denied_privs,
allowed_rules, denied_rules);
}
+static void check_app_after_install(const char *const app_id, const char *const pkg_id)
+{
+ TestSecurityManagerDatabase dbtest;
+ dbtest.test_db_after__app_install(app_id, pkg_id);
+}
+
+static void check_app_after_uninstall(const char *const app_id, const char *const pkg_id,
+ const privileges_t &privileges, const bool is_pkg_removed)
+{
+ TestSecurityManagerDatabase dbtest;
+ dbtest.test_db_after__app_uninstall(app_id, pkg_id, privileges, is_pkg_removed);
+}
+
+static void check_app_after_uninstall(const char *const app_id, const char *const pkg_id,
+ const bool is_pkg_removed)
+{
+ TestSecurityManagerDatabase dbtest;
+ dbtest.test_db_after__app_uninstall(app_id, pkg_id, is_pkg_removed);
+}
+
+
RUNNER_TEST_GROUP_INIT(SECURITY_MANAGER)
RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"installing already installed app failed. Result: " << result);
+ /* Check records in the security-manager database */
+ check_app_after_install(SM_APP_ID1, SM_PKG_ID1);
+
request.reset(do_app_inst_req_new());
result = security_manager_app_inst_req_set_app_id(request.get(), SM_APP_ID1);
result = security_manager_app_uninstall(request.get());
RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"uninstalling already uninstalled app failed. Result: " << result);
+
+ /* Check records in the security-manager database */
+ check_app_after_uninstall(SM_APP_ID1, SM_PKG_ID1, TestSecurityManagerDatabase::REMOVED);
}
RUNNER_TEST(security_manager_02_app_install_uninstall_full)
RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"installing app failed. Result: " << result);
+ /* Check records in the security-manager database */
check_app_after_install(SM_APP_ID2, SM_PKG_ID2,
SM_ALLOWED_PRIVILEGES, SM_DENIED_PRIVILEGES,
SM_ALLOWED_RULES, SM_DENIED_RULES);
RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"uninstalling app failed. Result: " << result);
+ /* Check records in the security-manager database,
+ * all previously allowed privileges should be removed */
+ check_app_after_uninstall(SM_APP_ID2, SM_PKG_ID2,
+ SM_ALLOWED_PRIVILEGES, TestSecurityManagerDatabase::REMOVED);
}
int main(int argc, char *argv[])