diff --git a/tests/foreman/api/test_role.py b/tests/foreman/api/test_role.py index c6565c38fae..7933d1785df 100644 --- a/tests/foreman/api/test_role.py +++ b/tests/foreman/api/test_role.py @@ -581,7 +581,7 @@ def test_negative_access_entities_from_org_admin( sc = self.user_config(user, target_sat) # Getting the domain from user with pytest.raises(HTTPError): - target_sat.api.Domain(sc, id=domain.id).read() + target_sat.api.Domain(server_config=sc, id=domain.id).read() @pytest.mark.tier3 def test_negative_access_entities_from_user( @@ -613,7 +613,7 @@ def test_negative_access_entities_from_user( sc = self.user_config(user, target_sat) # Getting the domain from user with pytest.raises(HTTPError): - target_sat.api.Domain(sc, id=domain.id).read() + target_sat.api.Domain(server_config=sc, id=domain.id).read() @pytest.mark.tier2 def test_positive_override_cloned_role_filter(self, role_taxonomies, target_sat): @@ -1000,13 +1000,13 @@ def test_positive_user_group_users_access_as_org_admin(self, role_taxonomies, ta auth=(login, password), url=target_sat.url, verify=settings.server.verify_ca ) try: - target_sat.api.Domain(sc).search( + target_sat.api.Domain(server_config=sc).search( query={ 'organization-id': role_taxonomies['org'].id, 'location-id': role_taxonomies['loc'].id, } ) - target_sat.api.Subnet(sc).search( + target_sat.api.Subnet(server_config=sc).search( query={ 'organization-id': role_taxonomies['org'].id, 'location-id': role_taxonomies['loc'].id, @@ -1014,8 +1014,8 @@ def test_positive_user_group_users_access_as_org_admin(self, role_taxonomies, ta ) except HTTPError as err: pytest.fail(str(err)) - assert domain.id in [dom.id for dom in target_sat.api.Domain(sc).search()] - assert subnet.id in [sub.id for sub in target_sat.api.Subnet(sc).search()] + assert domain.id in [dom.id for dom in target_sat.api.Domain(server_config=sc).search()] + assert subnet.id in [sub.id for sub in target_sat.api.Subnet(server_config=sc).search()] @pytest.mark.tier3 def test_positive_user_group_users_access_contradict_as_org_admins(self): @@ -1080,7 +1080,7 @@ def test_negative_assign_org_admin_to_user_group( for user in [user_one, user_two]: sc = self.user_config(user, target_sat) with pytest.raises(HTTPError): - target_sat.api.Domain(sc, id=dom.id).read() + target_sat.api.Domain(server_config=sc, id=dom.id).read() @pytest.mark.tier2 def test_negative_assign_taxonomies_by_org_admin( @@ -1130,7 +1130,7 @@ def test_negative_assign_taxonomies_by_org_admin( auth=(user_login, user_pass), url=target_sat.url, verify=settings.server.verify_ca ) # Getting the domain from user1 - dom = target_sat.api.Domain(sc, id=dom.id).read() + dom = target_sat.api.Domain(server_config=sc, id=dom.id).read() dom.organization = [filter_taxonomies['org']] with pytest.raises(HTTPError): dom.update(['organization']) @@ -1298,7 +1298,7 @@ def test_negative_create_roles_by_org_admin(self, role_taxonomies, target_sat): role_name = gen_string('alpha') with pytest.raises(HTTPError): target_sat.api.Role( - sc, + server_config=sc, name=role_name, organization=[role_taxonomies['org']], location=[role_taxonomies['loc']], @@ -1325,7 +1325,7 @@ def test_negative_modify_roles_by_org_admin(self, role_taxonomies, target_sat): ) test_role = target_sat.api.Role().create() sc = self.user_config(user, target_sat) - test_role = target_sat.api.Role(sc, id=test_role.id).read() + test_role = target_sat.api.Role(server_config=sc, id=test_role.id).read() test_role.organization = [role_taxonomies['org']] test_role.location = [role_taxonomies['loc']] with pytest.raises(HTTPError): @@ -1364,7 +1364,7 @@ def test_negative_admin_permissions_to_org_admin(self, role_taxonomies, target_s auth=(user_login, user_pass), url=target_sat.url, verify=settings.server.verify_ca ) with pytest.raises(HTTPError): - target_sat.api.User(sc, id=1).read() + target_sat.api.User(server_config=sc, id=1).read() @pytest.mark.tier2 @pytest.mark.upgrade @@ -1412,7 +1412,7 @@ def test_positive_create_user_by_org_admin(self, role_taxonomies, target_sat): user_login = gen_string('alpha') user_pass = gen_string('alphanumeric') user = target_sat.api.User( - sc_user, + server_config=sc_user, login=user_login, password=user_pass, role=[org_admin.id], @@ -1452,7 +1452,7 @@ def test_positive_access_users_inside_org_admin_taxonomies(self, 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() + target_sat.api.User(server_config=sc, id=test_user.id).read() except HTTPError as err: pytest.fail(str(err)) @@ -1493,7 +1493,9 @@ def test_positive_create_nested_location(self, role_taxonomies, target_sat): auth=(user_login, user_pass), url=target_sat.url, verify=settings.server.verify_ca ) name = gen_string('alphanumeric') - location = target_sat.api.Location(sc, name=name, parent=role_taxonomies['loc'].id).create() + location = target_sat.api.Location( + server_config=sc, name=name, parent=role_taxonomies['loc'].id + ).create() assert location.name == name @pytest.mark.tier2 @@ -1524,7 +1526,7 @@ def test_negative_access_users_outside_org_admin_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() + target_sat.api.User(server_config=sc, id=test_user.id).read() @pytest.mark.tier1 def test_negative_create_taxonomies_by_org_admin(self, role_taxonomies, target_sat): @@ -1560,11 +1562,11 @@ def test_negative_create_taxonomies_by_org_admin(self, role_taxonomies, target_s auth=(user_login, user_pass), url=target_sat.url, verify=settings.server.verify_ca ) with pytest.raises(HTTPError): - target_sat.api.Organization(sc, name=gen_string('alpha')).create() + target_sat.api.Organization(server_config=sc, name=gen_string('alpha')).create() if not is_open("BZ:1825698"): try: loc_name = gen_string('alpha') - loc = target_sat.api.Location(sc, name=loc_name).create() + loc = target_sat.api.Location(server_config=sc, name=loc_name).create() except HTTPError as err: pytest.fail(str(err)) assert loc_name == loc.name @@ -1617,7 +1619,7 @@ def test_positive_access_all_global_entities_by_org_admin( target_sat.api.Errata, target_sat.api.OperatingSystem, ]: - entity(sc).search() + entity(server_config=sc).search() except HTTPError as err: pytest.fail(str(err)) @@ -1656,7 +1658,7 @@ def test_negative_access_entities_from_ldap_org_admin( verify=settings.server.verify_ca, ) with pytest.raises(HTTPError): - target_sat.api.Architecture(sc).search() + target_sat.api.Architecture(server_config=sc).search() user = target_sat.api.User().search( query={'search': f"login={create_ldap['ldap_user_name']}"} )[0] @@ -1664,7 +1666,7 @@ def test_negative_access_entities_from_ldap_org_admin( user.update(['role']) # Trying to access the domain resource created in org admin role with pytest.raises(HTTPError): - target_sat.api.Domain(sc, id=domain.id).read() + target_sat.api.Domain(server_config=sc, id=domain.id).read() @pytest.mark.tier3 def test_negative_access_entities_from_ldap_user( @@ -1699,7 +1701,7 @@ def test_negative_access_entities_from_ldap_user( verify=settings.server.verify_ca, ) with pytest.raises(HTTPError): - target_sat.api.Architecture(sc).search() + target_sat.api.Architecture(server_config=sc).search() user = target_sat.api.User().search( query={'search': f"login={create_ldap['ldap_user_name']}"} )[0] @@ -1707,7 +1709,7 @@ def test_negative_access_entities_from_ldap_user( user.update(['role']) # Trying to access the Domain resource with pytest.raises(HTTPError): - target_sat.api.Domain(sc, id=domain.id).read() + target_sat.api.Domain(server_config=sc, id=domain.id).read() @pytest.mark.tier3 def test_positive_assign_org_admin_to_ldap_user_group( @@ -1769,7 +1771,7 @@ def test_positive_assign_org_admin_to_ldap_user_group( verify=settings.server.verify_ca, ) # Accessing the Domain resource - target_sat.api.Domain(sc, id=domain.id).read() + target_sat.api.Domain(server_config=sc, id=domain.id).read() @pytest.mark.tier3 def test_negative_assign_org_admin_to_ldap_user_group( @@ -1828,7 +1830,7 @@ def test_negative_assign_org_admin_to_ldap_user_group( ) # Trying to access the Domain resource with pytest.raises(HTTPError): - target_sat.api.Domain(sc, id=domain.id).read() + target_sat.api.Domain(server_config=sc, id=domain.id).read() class TestRoleSearchFilter: diff --git a/tests/foreman/api/test_user.py b/tests/foreman/api/test_user.py index 6fc5d0e4abd..20fd27b59e7 100644 --- a/tests/foreman/api/test_user.py +++ b/tests/foreman/api/test_user.py @@ -415,8 +415,12 @@ def test_positive_table_preferences(self, module_target_sat): sc = ServerConfig( auth=(user.login, password), url=module_target_sat.url, verify=settings.server.verify_ca ) - module_target_sat.api.TablePreferences(sc, user=user, name=name, columns=columns).create() - table_preferences = module_target_sat.api.TablePreferences(sc, user=user).search() + module_target_sat.api.TablePreferences( + server_config=sc, user=user, name=name, columns=columns + ).create() + table_preferences = module_target_sat.api.TablePreferences( + server_config=sc, user=user + ).search() assert len(table_preferences) == 1 tp = table_preferences[0] assert hasattr(tp, 'name') @@ -724,7 +728,7 @@ def test_positive_ad_basic_no_roles(self, create_ldap, target_sat): verify=settings.server.verify_ca, ) with pytest.raises(HTTPError): - target_sat.api.Architecture(sc).search() + target_sat.api.Architecture(server_config=sc).search() @pytest.mark.tier3 @pytest.mark.upgrade @@ -764,7 +768,7 @@ def test_positive_access_entities_from_ldap_org_admin(self, create_ldap, module_ verify=settings.server.verify_ca, ) with pytest.raises(HTTPError): - module_target_sat.api.Architecture(sc).search() + module_target_sat.api.Architecture(server_config=sc).search() user = module_target_sat.api.User().search( query={'search': 'login={}'.format(create_ldap['ldap_user_name'])} )[0] @@ -781,7 +785,7 @@ def test_positive_access_entities_from_ldap_org_admin(self, create_ldap, module_ module_target_sat.api.Errata, module_target_sat.api.OperatingSystem, ]: - entity(sc).search() + entity(server_config=sc).search() @pytest.mark.run_in_one_thread @@ -845,7 +849,7 @@ def test_positive_ipa_basic_no_roles(self, create_ldap, target_sat): verify=settings.server.verify_ca, ) with pytest.raises(HTTPError): - target_sat.api.Architecture(sc).search() + target_sat.api.Architecture(server_config=sc).search() @pytest.mark.tier3 @pytest.mark.upgrade @@ -885,7 +889,7 @@ def test_positive_access_entities_from_ipa_org_admin(self, create_ldap, target_s verify=settings.server.verify_ca, ) with pytest.raises(HTTPError): - target_sat.api.Architecture(sc).search() + target_sat.api.Architecture(server_config=sc).search() user = target_sat.api.User().search( query={'search': 'login={}'.format(create_ldap['username'])} )[0] @@ -902,7 +906,7 @@ def test_positive_access_entities_from_ipa_org_admin(self, create_ldap, target_s target_sat.api.Errata, target_sat.api.OperatingSystem, ]: - entity(sc).search() + entity(server_config=sc).search() class TestPersonalAccessToken: