From 4056a13b48d57bd39897f685814a7f84d6174cf8 Mon Sep 17 00:00:00 2001 From: Peter Ondrejka Date: Tue, 23 Jan 2024 11:32:30 +0100 Subject: [PATCH] fixes in api role helper functions (#13849) paramter order in api role helper functions (cherry picked from commit b588165f567a830ef7175b08128ce34295e4dfd2) --- tests/foreman/api/test_role.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/foreman/api/test_role.py b/tests/foreman/api/test_role.py index 06bcab11772..ed6834f5987 100644 --- a/tests/foreman/api/test_role.py +++ b/tests/foreman/api/test_role.py @@ -576,7 +576,7 @@ def test_negative_access_entities_from_org_admin( target_sat, role_taxos=role_taxonomies, user_taxos=filter_taxonomies ) domain = self.create_domain( - orgs=[role_taxonomies['org'].id], locs=[role_taxonomies['loc'].id] + target_sat, orgs=[role_taxonomies['org'].id], locs=[role_taxonomies['loc'].id] ) sc = self.user_config(user, target_sat) # Getting the domain from user @@ -608,7 +608,7 @@ def test_negative_access_entities_from_user( target_sat, role_taxos=role_taxonomies, user_taxos=filter_taxonomies ) domain = self.create_domain( - orgs=[filter_taxonomies['org'].id], locs=[filter_taxonomies['loc'].id] + target_sat, orgs=[filter_taxonomies['org'].id], locs=[filter_taxonomies['loc'].id] ) sc = self.user_config(user, target_sat) # Getting the domain from user @@ -1074,7 +1074,9 @@ def test_negative_assign_org_admin_to_user_group( name=ug_name, role=[org_admin.id], user=[user_one.id, user_two.id] ).create() assert user_group.name == ug_name - dom = self.create_domain(orgs=[role_taxonomies['org'].id], locs=[role_taxonomies['loc'].id]) + dom = self.create_domain( + target_sat, orgs=[role_taxonomies['org'].id], locs=[role_taxonomies['loc'].id] + ) for user in [user_one, user_two]: sc = self.user_config(user, target_sat) with pytest.raises(HTTPError): @@ -1447,7 +1449,7 @@ def test_positive_access_users_inside_org_admin_taxonomies(self, role_taxonomies user = self.create_org_admin_user( target_sat, role_taxos=role_taxonomies, user_taxos=role_taxonomies ) - test_user = self.create_simple_user(filter_taxos=role_taxonomies) + test_user = self.create_simple_user(target_sat, filter_taxos=role_taxonomies) sc = self.user_config(user, target_sat) try: target_sat.api.User(sc, id=test_user.id).read() @@ -1519,7 +1521,7 @@ def test_negative_access_users_outside_org_admin_taxonomies( user = self.create_org_admin_user( target_sat, role_taxos=role_taxonomies, user_taxos=role_taxonomies ) - test_user = self.create_simple_user(filter_taxos=filter_taxonomies) + test_user = self.create_simple_user(target_sat, filter_taxos=filter_taxonomies) sc = self.user_config(user, target_sat) with pytest.raises(HTTPError): target_sat.api.User(sc, id=test_user.id).read() @@ -1646,7 +1648,7 @@ def test_negative_access_entities_from_ldap_org_admin( ) # Creating Domain resource in same taxonomies as Org Admin role to access later domain = self.create_domain( - orgs=[role_taxonomies['org'].id], locs=[role_taxonomies['loc'].id] + target_sat, orgs=[role_taxonomies['org'].id], locs=[role_taxonomies['loc'].id] ) sc = ServerConfig( auth=(create_ldap['ldap_user_name'], create_ldap['ldap_user_passwd']), @@ -1690,7 +1692,7 @@ def test_negative_access_entities_from_ldap_user( target_sat, orgs=[role_taxonomies['org'].id], locs=[role_taxonomies['loc'].id] ) # Creating Domain resource in different taxonomies to access later - domain = self.create_domain(orgs=[module_org.id], locs=[module_location.id]) + domain = self.create_domain(target_sat, orgs=[module_org.id], locs=[module_location.id]) sc = ServerConfig( auth=(create_ldap['ldap_user_name'], create_ldap['ldap_user_passwd']), url=create_ldap['sat_url'], @@ -1739,6 +1741,7 @@ def test_positive_assign_org_admin_to_ldap_user_group( ) # Creating Domain resource in same taxonomies as Org Admin role to access later domain = self.create_domain( + target_sat, orgs=[create_ldap['authsource'].organization[0].id], locs=[create_ldap['authsource'].location[0].id], ) @@ -1798,7 +1801,7 @@ def test_negative_assign_org_admin_to_ldap_user_group( ) # Creating Domain resource in same taxonomies as Org Admin role to access later domain = self.create_domain( - orgs=[role_taxonomies['org'].id], locs=[role_taxonomies['loc'].id] + target_sat, orgs=[role_taxonomies['org'].id], locs=[role_taxonomies['loc'].id] ) users = [ target_sat.api.User(