From 1fee76061d5fe7326adb9ebb69b5bd02ccea102a Mon Sep 17 00:00:00 2001 From: vsedmik <46570670+vsedmik@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:02:05 +0100 Subject: [PATCH] Fix Capsule test case for non-admin user (#17422) (cherry picked from commit 32a07bea2c7eedccd0ab25057b38a0c97b8efd80) --- tests/foreman/api/test_capsulecontent.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/foreman/api/test_capsulecontent.py b/tests/foreman/api/test_capsulecontent.py index 2ed9dd58ae..69c3c5fd63 100644 --- a/tests/foreman/api/test_capsulecontent.py +++ b/tests/foreman/api/test_capsulecontent.py @@ -1786,6 +1786,7 @@ def test_positive_read_with_non_admin_user( target_sat, module_capsule_configured, default_org, + default_location, default_non_admin_user, ): """Try to list and read Capsules with a non-admin user with and without permissions. @@ -1797,8 +1798,9 @@ def test_positive_read_with_non_admin_user( 2. Non-admin user without any roles/permissions. :steps: - 1. Using the non-admin user try to list all or particular Capsule. - 2. Add Viewer role to the user and try again. + 1. Assign the capsule to the default org/loc so it can be searched and found. + 2. Using the non-admin user try to list all or particular Capsule. + 3. Add Viewer role to the user and try again. :expectedresults: 1. Read should fail without Viewer role. @@ -1808,6 +1810,12 @@ def test_positive_read_with_non_admin_user( :customerscenario: true """ + # Assign the capsule to the default org/loc so it can be searched and found. + nc = module_capsule_configured.nailgun_smart_proxy + target_sat.api.SmartProxy( + id=nc.id, organization=[default_org], location=[default_location] + ).update(['organization', 'location']) + # Using the non-admin user try to list all or particular Capsule user = default_non_admin_user sc = ServerConfig(