From f901fe3312fa12a3702fdf6c720cd6ae4d998213 Mon Sep 17 00:00:00 2001 From: Hadeer-Elsaeed Date: Mon, 2 Jan 2023 18:03:13 +0200 Subject: [PATCH] feat(api): fix testing --- tests/test_keycloak_admin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_keycloak_admin.py b/tests/test_keycloak_admin.py index 87b71a1..ad0feda 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 - admin.create_client_authz_scope_permission( + res = admin.create_client_authz_scope_permission( payload={ "name": "test-permission", "type": "scope", @@ -1577,8 +1577,11 @@ 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_scope(payload={"name": "test-scope"}) + 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"