Browse Source

fix: remove duplicate function

pull/358/head
Luca Paganin 2 years ago
parent
commit
2d217eca1c
  1. 12
      src/keycloak/keycloak_admin.py
  2. 10
      tests/test_keycloak_admin.py

12
src/keycloak/keycloak_admin.py

@ -2844,18 +2844,6 @@ class KeycloakAdmin:
data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENT_ROLE_CHILDREN.format(**params_path)) data_raw = self.raw_get(urls_patterns.URL_ADMIN_CLIENT_ROLE_CHILDREN.format(**params_path))
return raise_error_from_response(data_raw, KeycloakGetError) return raise_error_from_response(data_raw, KeycloakGetError)
def get_user_credentials(self, user_id):
"""Get the credentials of the given user.
:param user_id: id of the user.
:type user_id: str
:return: the user credentials (list of CredentialsRepresentation).
:rtype: list
"""
params_path = {"realm-name": self.realm_name, "id": user_id}
data_raw = self.raw_get(urls_patterns.URL_ADMIN_USER_CREDENTIALS.format(**params_path))
return raise_error_from_response(data_raw, KeycloakGetError)
def upload_certificate(self, client_id, certcont): def upload_certificate(self, client_id, certcont):
"""Upload a new certificate for the client. """Upload a new certificate for the client.

10
tests/test_keycloak_admin.py

@ -1880,16 +1880,6 @@ 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_user_credentials(admin: KeycloakAdmin, realm: str, user: str):
"""Test get user credentials."""
admin.realm_name = realm
admin.set_user_password(user, "pwd", temporary=False)
res = admin.get_user_credentials(user)
assert isinstance(res, list)
assert len(res) == 1
assert res[0]["type"] == "password"
def test_upload_certificate(admin: KeycloakAdmin, realm: str, client: str, selfsigned_cert: tuple): def test_upload_certificate(admin: KeycloakAdmin, realm: str, client: str, selfsigned_cert: tuple):
"""Test upload certificate.""" """Test upload certificate."""
admin.realm_name = realm admin.realm_name = realm

Loading…
Cancel
Save