From c9478d9f1a0b7739d408c0f467a1e0dbcc97754d Mon Sep 17 00:00:00 2001 From: Hadeer-Elsaeed Date: Mon, 2 Jan 2023 18:26:24 +0200 Subject: [PATCH] feat(api): fix testing for create client_authz_scope_permission --- tests/test_keycloak_admin.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_keycloak_admin.py b/tests/test_keycloak_admin.py index ad0feda..63e1d6c 100644 --- a/tests/test_keycloak_admin.py +++ b/tests/test_keycloak_admin.py @@ -1565,7 +1565,7 @@ def test_enable_token_exchange(admin: KeycloakAdmin, realm: str): ) # Create permissions on the target client to reference this policy - res = admin.create_client_authz_scope_permission( + admin.create_client_authz_scope_permission( payload={ "name": "test-permission", "type": "scope", @@ -1577,16 +1577,16 @@ def test_enable_token_exchange(admin: KeycloakAdmin, realm: str): }, client_id=realm_management_id, ) - assert res - with pytest.raises(KeycloakPostError) as err: - admin.create_client_authz_scope_permission( - payload={"name": "test-scope"}, client_id="realm_management_id" - ) - assert err.match('404: b\'{"errorMessage":"Could not find client"}\'') permission_name = admin.get_client_authz_scope_permission(client_id=realm_management_id)[ "name" ] assert permission_name == "test-permission" + with pytest.raises(KeycloakPostError) as err: + admin.create_client_authz_scope_permission( + payload={"name": "test-permission", "scopes": [token_exchange_scope_id]}, + client_id="realm_management_id", + ) + assert err.match('404: b\'{"errorMessage":"Could not find client"}\'') def test_email(admin: KeycloakAdmin, user: str):