From 8591612d455cc89d702eb9dfced7c467416c1b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hellebrandt?= Date: Wed, 27 Sep 2023 08:37:40 +0200 Subject: [PATCH] Workaround nonexistent auth source in upgrade template (#12722) (cherry picked from commit 23d49f5634cfa7d1af2c131383d5fff5f4fb6d43) --- tests/foreman/api/test_user.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/foreman/api/test_user.py b/tests/foreman/api/test_user.py index 59e8ba515fc..cab7b49d653 100644 --- a/tests/foreman/api/test_user.py +++ b/tests/foreman/api/test_user.py @@ -733,7 +733,7 @@ def test_positive_ad_basic_no_roles(self, create_ldap): @pytest.mark.tier3 @pytest.mark.upgrade - def test_positive_access_entities_from_ldap_org_admin(self, create_ldap): + def test_positive_access_entities_from_ldap_org_admin(self, create_ldap, module_target_sat): """LDAP User can access resources within its taxonomies if assigned role has permission for same taxonomies @@ -751,6 +751,16 @@ def test_positive_access_entities_from_ldap_org_admin(self, create_ldap): :CaseLevel: System """ + # Workaround issue where, in an upgrade template, there is already + # some auth source present with this user. That auth source instance + # doesn't really run and attempting to login as that user + # leads to ISE 500 (which is itself a bug, the error should be handled, it is + # reported as BZ2240205). + for user in module_target_sat.api.User().search( + query={'search': f'login={create_ldap["ldap_user_name"]}'} + ): + user.delete() + role_name = gen_string('alpha') default_org_admin = entities.Role().search(query={'search': 'name="Organization admin"'}) org_admin = entities.Role(id=default_org_admin[0].id).clone(