From d389d12021c7737eff77e748579a548c6747b5a3 Mon Sep 17 00:00:00 2001 From: dosas Date: Wed, 20 Nov 2024 12:02:40 +0100 Subject: [PATCH] Add permission tests for foreman_salt --- robottelo/constants/__init__.py | 34 +++++++++++++++++++++++++++- tests/foreman/api/test_permission.py | 12 ++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index 142c47cf7d..8a0637f4c7 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -1015,7 +1015,31 @@ 'destroy_external_usergroups', ], 'FactValue': ['view_facts', 'upload_facts'], - 'Filter': ['view_filters', 'create_filters', 'edit_filters', 'destroy_filters'], + 'Filter': [ + 'view_filters', + 'create_filters', + 'edit_filters', + 'destroy_filters', + ], + 'ForemanSalt::SaltVariable': [ + 'edit_salt_variables', + 'destroy_salt_variables', + 'create_salt_variables', + 'view_salt_variables', + ], + 'ForemanSalt::SaltEnvironment': [ + 'edit_salt_environments', + 'create_salt_environments', + 'destroy_salt_environments', + 'view_salt_environments', + ], + 'ForemanSalt::SaltModule': [ + 'import_salt_modules', + 'create_salt_modules', + 'edit_salt_modules', + 'view_salt_modules', + 'destroy_salt_modules', + ], 'ForemanTasks::RecurringLogic': [ 'create_recurring_logics', 'view_recurring_logics', @@ -1199,6 +1223,13 @@ 'manage_capsule_content', 'view_capsule_content', 'view_openscap_proxies', + 'destroy_smart_proxies_salt_autosign', + 'view_smart_proxies_salt_autosign', + 'destroy_smart_proxies_salt_keys', + 'view_smart_proxies_salt_keys', + 'edit_smart_proxies_salt_keys', + 'auth_smart_proxies_salt_autosign', + 'create_smart_proxies_salt_autosign', ], 'SshKey': ["view_ssh_keys", "create_ssh_keys", "destroy_ssh_keys"], 'Subnet': [ @@ -1247,6 +1278,7 @@ 'view_discovered_hosts', 'view_hosts', 'forget_status_hosts', + 'saltrun_hosts', ], 'Katello::ActivationKey': [ 'view_activation_keys', diff --git a/tests/foreman/api/test_permission.py b/tests/foreman/api/test_permission.py index 731ad88017..578baa0714 100644 --- a/tests/foreman/api/test_permission.py +++ b/tests/foreman/api/test_permission.py @@ -71,6 +71,18 @@ def create_permissions(self, class_target_sat): if 'rubygem-foreman_scc_manager' not in rpm_packages: cls.permissions.pop('SccAccount') cls.permissions.pop('SccProduct') + if 'rubygem-foreman_salt' not in rpm_packages: + cls.permissions['Host'].remove('saltrun_hosts') + cls.permissions['SmartProxy'].remove('destroy_smart_proxies_salt_autosign') + cls.permissions['SmartProxy'].remove('view_smart_proxies_salt_autosign') + cls.permissions['SmartProxy'].remove('destroy_smart_proxies_salt_keys') + cls.permissions['SmartProxy'].remove('view_smart_proxies_salt_keys') + cls.permissions['SmartProxy'].remove('edit_smart_proxies_salt_keys') + cls.permissions['SmartProxy'].remove('auth_smart_proxies_salt_autosign') + cls.permissions['SmartProxy'].remove('create_smart_proxies_salt_autosign') + cls.permissions.pop('ForemanSalt::SaltVariable') + cls.permissions.pop('ForemanSalt::SaltEnvironment') + cls.permissions.pop('ForemanSalt::SaltModule') #: e.g. ['Architecture', 'Audit', 'AuthSourceLdap', …] cls.permission_resource_types = list(cls.permissions.keys())