|
|
@ -3285,6 +3285,48 @@ def test_get_role_client_level_children( |
|
|
assert child["id"] in [x["id"] for x in res] |
|
|
assert child["id"] in [x["id"] for x in res] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_get_role_composites_by_id( |
|
|
|
|
|
admin: KeycloakAdmin, |
|
|
|
|
|
realm: str, |
|
|
|
|
|
client: str, |
|
|
|
|
|
composite_client_role: str, |
|
|
|
|
|
client_role: str, |
|
|
|
|
|
) -> None: |
|
|
|
|
|
""" |
|
|
|
|
|
Test get role's children by role ID. |
|
|
|
|
|
|
|
|
|
|
|
:param admin: Keycloak Admin client |
|
|
|
|
|
:type admin: KeycloakAdmin |
|
|
|
|
|
:param realm: Keycloak realm |
|
|
|
|
|
:type realm: str |
|
|
|
|
|
:param client: Keycloak client |
|
|
|
|
|
:type client: str |
|
|
|
|
|
:param composite_client_role: Composite client role |
|
|
|
|
|
:type composite_client_role: str |
|
|
|
|
|
:param client_role: Client role |
|
|
|
|
|
:type client_role: str |
|
|
|
|
|
""" |
|
|
|
|
|
admin.change_current_realm(realm) |
|
|
|
|
|
|
|
|
|
|
|
parent_role = admin.get_client_role(client, composite_client_role) |
|
|
|
|
|
child_role = admin.get_client_role(client, client_role) |
|
|
|
|
|
|
|
|
|
|
|
composites = admin.get_role_composites_by_id(parent_role["id"]) |
|
|
|
|
|
assert len(composites) > 0 |
|
|
|
|
|
assert child_role["id"] in [x["id"] for x in composites] |
|
|
|
|
|
|
|
|
|
|
|
composites_paginated = admin.get_role_composites_by_id( |
|
|
|
|
|
parent_role["id"], query={"first": 0, "max": 10} |
|
|
|
|
|
) |
|
|
|
|
|
assert len(composites_paginated) > 0 |
|
|
|
|
|
assert child_role["id"] in [x["id"] for x in composites_paginated] |
|
|
|
|
|
|
|
|
|
|
|
composites_searched = admin.get_role_composites_by_id( |
|
|
|
|
|
parent_role["id"], query={"search": client_role[:3]} |
|
|
|
|
|
) |
|
|
|
|
|
assert len(composites_searched) > 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_upload_certificate( |
|
|
def test_upload_certificate( |
|
|
admin: KeycloakAdmin, |
|
|
admin: KeycloakAdmin, |
|
|
realm: str, |
|
|
realm: str, |
|
|
@ -7017,6 +7059,49 @@ async def test_a_get_role_client_level_children( |
|
|
assert child["id"] in [x["id"] for x in res] |
|
|
assert child["id"] in [x["id"] for x in res] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.asyncio |
|
|
|
|
|
async def test_a_get_role_composites_by_id( |
|
|
|
|
|
admin: KeycloakAdmin, |
|
|
|
|
|
realm: str, |
|
|
|
|
|
client: str, |
|
|
|
|
|
composite_client_role: str, |
|
|
|
|
|
client_role: str, |
|
|
|
|
|
) -> None: |
|
|
|
|
|
""" |
|
|
|
|
|
Test get all composite roles by role id asynchronously. |
|
|
|
|
|
|
|
|
|
|
|
:param admin: Keycloak Admin client |
|
|
|
|
|
:type admin: KeycloakAdmin |
|
|
|
|
|
:param realm: Keycloak realm |
|
|
|
|
|
:type realm: str |
|
|
|
|
|
:param client: Keycloak client |
|
|
|
|
|
:type client: str |
|
|
|
|
|
:param composite_client_role: Composite client role |
|
|
|
|
|
:type composite_client_role: str |
|
|
|
|
|
:param client_role: Client role |
|
|
|
|
|
:type client_role: str |
|
|
|
|
|
""" |
|
|
|
|
|
await admin.a_change_current_realm(realm) |
|
|
|
|
|
|
|
|
|
|
|
parent_role = await admin.a_get_client_role(client, composite_client_role) |
|
|
|
|
|
child_role = await admin.a_get_client_role(client, client_role) |
|
|
|
|
|
|
|
|
|
|
|
composites = await admin.a_get_role_composites_by_id(parent_role["id"]) |
|
|
|
|
|
assert len(composites) > 0 |
|
|
|
|
|
assert child_role["id"] in [x["id"] for x in composites] |
|
|
|
|
|
|
|
|
|
|
|
composites_paginated = await admin.a_get_role_composites_by_id( |
|
|
|
|
|
parent_role["id"], query={"first": 0, "max": 10} |
|
|
|
|
|
) |
|
|
|
|
|
assert len(composites_paginated) > 0 |
|
|
|
|
|
assert child_role["id"] in [x["id"] for x in composites_paginated] |
|
|
|
|
|
|
|
|
|
|
|
composites_searched = await admin.a_get_role_composites_by_id( |
|
|
|
|
|
parent_role["id"], query={"search": client_role[:3]} |
|
|
|
|
|
) |
|
|
|
|
|
assert len(composites_searched) > 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.asyncio |
|
|
@pytest.mark.asyncio |
|
|
async def test_a_upload_certificate( |
|
|
async def test_a_upload_certificate( |
|
|
admin: KeycloakAdmin, |
|
|
admin: KeycloakAdmin, |
|
|
|