Skip to content

Commit

Permalink
add test for /groups returning empty subgroups
Browse files Browse the repository at this point in the history
  • Loading branch information
vbrik committed Nov 27, 2024
1 parent ac1ae2b commit a0d2a6e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/krs/test_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@

from ..util import keycloak_bootstrap

@pytest.mark.asyncio
async def test_confirm_empty_subgroups_keycloak_quirk(keycloak_bootstrap):
await groups.create_group('/group', rest_client=keycloak_bootstrap)
await groups.create_group('/group/subgroup', rest_client=keycloak_bootstrap)
ret = await keycloak_bootstrap.request(
'GET', "/groups?briefRepresentation=false&populateHierarchy=true")
if ret[0]['subGroups']:
pytest.fail("""See full failure message.
It looks like bug where /groups incorrectly returns empty subgroups has been fixed
(see https://github.com/keycloak/keycloak/issues/27694).
This means that some functions that use the /groups endpoint unnecessarily apply
workarounds, which probably significantly slows them down.
At the time of writing these are the affected functions:
* group_info_by_id(): unnecessarily calls a function to populate subgroups,
which is quite slow.
* get_group_hierarchy(): unnecessarily inserts "search=" into the URL,
which probably slows it down.
""")

@pytest.mark.asyncio
async def test_list_groups_empty(keycloak_bootstrap):
ret = await groups.list_groups(rest_client=keycloak_bootstrap)
Expand Down

0 comments on commit a0d2a6e

Please sign in to comment.