Browse Source

feat(api): fix testing for create client_authz_scope_permission

pull/400/head
Hadeer-Elsaeed 2 years ago
parent
commit
c9478d9f1a
  1. 14
      tests/test_keycloak_admin.py

14
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 # Create permissions on the target client to reference this policy
res = admin.create_client_authz_scope_permission(
admin.create_client_authz_scope_permission(
payload={ payload={
"name": "test-permission", "name": "test-permission",
"type": "scope", "type": "scope",
@ -1577,16 +1577,16 @@ def test_enable_token_exchange(admin: KeycloakAdmin, realm: str):
}, },
client_id=realm_management_id, 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)[ permission_name = admin.get_client_authz_scope_permission(client_id=realm_management_id)[
"name" "name"
] ]
assert permission_name == "test-permission" 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): def test_email(admin: KeycloakAdmin, user: str):

Loading…
Cancel
Save