Skip to content

Commit

Permalink
fix: name of client_id parameter
Browse files Browse the repository at this point in the history
The name client_role_id for the parameter is confusing because it
expects the client_id.
  • Loading branch information
tobiasge authored and marcospereirampj committed Feb 14, 2024
1 parent 0af6e46 commit 70af4bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/keycloak/keycloak_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2453,14 +2453,14 @@ def add_composite_client_roles_to_role(self, client_role_id, role_name, roles):
)
return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[204])

def update_client_role(self, client_role_id, role_name, payload):
def update_client_role(self, client_id, role_name, payload):
"""Update a client role.
RoleRepresentation
https://www.keycloak.org/docs-api/18.0/rest-api/index.html#_rolerepresentation
:param client_role_id: id of client (not client-id)
:type client_role_id: str
:param client_id: id of client (not client-id)
:type client_id: str
:param role_name: role's name (not id!)
:type role_name: str
:param payload: RoleRepresentation
Expand All @@ -2470,7 +2470,7 @@ def update_client_role(self, client_role_id, role_name, payload):
"""
params_path = {
"realm-name": self.connection.realm_name,
"id": client_role_id,
"id": client_id,
"role-name": role_name,
}
data_raw = self.connection.raw_put(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_keycloak_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1638,14 +1638,14 @@ def test_client_roles(admin: KeycloakAdmin, client: str):

# Test update client role
res = admin.update_client_role(
client_role_id=client,
client_id=client,
role_name="client-role-test",
payload={"name": "client-role-test-update"},
)
assert res == dict()
with pytest.raises(KeycloakPutError) as err:
res = admin.update_client_role(
client_role_id=client,
client_id=client,
role_name="client-role-test",
payload={"name": "client-role-test-update"},
)
Expand Down

0 comments on commit 70af4bf

Please sign in to comment.