From 4d2782404fbd700a8870c3795e4eadd0bc24bdd5 Mon Sep 17 00:00:00 2001 From: Lukas Hellebrandt Date: Wed, 3 Jan 2024 17:46:41 +0100 Subject: [PATCH] Put user in the correct location so the UI navigation doesn't fail --- pytest_fixtures/core/ui.py | 6 ++---- tests/foreman/ui/test_remoteexecution.py | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pytest_fixtures/core/ui.py b/pytest_fixtures/core/ui.py index e87a0bfb805..76dba9f0688 100644 --- a/pytest_fixtures/core/ui.py +++ b/pytest_fixtures/core/ui.py @@ -33,10 +33,8 @@ def ui_user(request, module_org, module_location, module_target_sat): user.password = password if not admin: # give all the permissions - #all_perms = sum(PERMISSIONS.values(), []) - all_perms = module_target_sat.cli.Filter.available_permissions() - all_perms_role = module_target_sat.cli_factory.make_role() - module_target_sat.cli_factory.make_filter({'role': all_perms_role, 'permissions': all_permissions}) + user.role = module_target_sat.api.Role().search(query={'per_page': 'all'}) + user.update(['role']) yield user try: logger.debug('Deleting session user %r', user.login) diff --git a/tests/foreman/ui/test_remoteexecution.py b/tests/foreman/ui/test_remoteexecution.py index 67c69b337ed..a37de212500 100644 --- a/tests/foreman/ui/test_remoteexecution.py +++ b/tests/foreman/ui/test_remoteexecution.py @@ -84,7 +84,7 @@ def test_positive_run_default_job_template_by_ip(session, rex_contenthost, modul @pytest.mark.rhel_ver_match('8') @pytest.mark.tier3 @pytest.mark.parametrize('ui_user', [{'admin': True}, {'admin': False}], indirect=True, ids=['adminuser', 'nonadminuser']) -def test_positive_run_custom_job_template_by_ip(session, module_org, rex_contenthost): +def test_positive_run_custom_job_template_by_ip(session, module_org, target_sat, default_location, ui_user, rex_contenthost): """Run a job template on a host connected by ip :id: 3a59eb15-67c4-46e1-ba5f-203496ec0b0c @@ -104,7 +104,8 @@ def test_positive_run_custom_job_template_by_ip(session, module_org, rex_content :CaseLevel: System """ - + ui_user.location.append(target_sat.api.Location(id=default_location.id)) + ui_user.update(['location']) hostname = rex_contenthost.hostname job_template_name = gen_string('alpha') with session: