Browse Source

fix: deprecate entitlement

fix/new-keycloak
Marcos Pereira Jr 10 months ago
parent
commit
da99042e82
  1. 2
      src/keycloak/keycloak_openid.py
  2. 4
      tests/test_keycloak_admin.py

2
src/keycloak/keycloak_openid.py

@ -477,7 +477,7 @@ class KeycloakOpenID:
params_path = {"realm-name": self.realm_name, "resource-server-id": resource_server_id}
data_raw = self.connection.raw_get(URL_ENTITLEMENT.format(**params_path))
if data_raw.status_code == 404:
if data_raw.status_code == 404 or data_raw.status_code == 405:
return raise_error_from_response(data_raw, KeycloakDeprecationError)
return raise_error_from_response(data_raw, KeycloakGetError) # pragma: no cover

4
tests/test_keycloak_admin.py

@ -660,14 +660,14 @@ def test_groups(admin: KeycloakAdmin, user: str):
# Test get groups again
groups = admin.get_groups()
assert len(groups) == 1, groups
assert len(groups[0]["subGroups"]) == 2, groups["subGroups"]
assert len(groups[0]["subGroups"]) == 2, groups[0]["subGroups"]
assert groups[0]["id"] == group_id
assert {x["id"] for x in groups[0]["subGroups"]} == {subgroup_id_1, subgroup_id_2}
# Test get groups query
groups = admin.get_groups(query={"max": 10})
assert len(groups) == 1, groups
assert len(groups[0]["subGroups"]) == 2, groups["subGroups"]
assert len(groups[0]["subGroups"]) == 2, groups[0]["subGroups"]
assert groups[0]["id"] == group_id
assert {x["id"] for x in groups[0]["subGroups"]} == {subgroup_id_1, subgroup_id_2}

Loading…
Cancel
Save