Commit 02179525 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fix keycloak test after switching from email to username.

parent e2d16c2e
Pipeline #67162 failed with stages
in 13 minutes and 55 seconds
......@@ -310,7 +310,7 @@ class Keycloak():
self.__user_from_keycloak_user(keycloak_user)
for keycloak_user in keycloak_results]
def get_user(self, user_id: str = None, email: str = None, user=None) -> object:
def get_user(self, user_id: str = None, username: str = None, user=None) -> object:
"""
Retrives all available information about a user from the keycloak admin
interface. This must be used to retrieve complete user information, because
......@@ -321,12 +321,12 @@ class Keycloak():
if user is not None and user_id is None:
user_id = user.user_id
if email is not None and user_id is None:
if username is not None and user_id is None:
with utils.lnr(logger, 'Could not use keycloak admin client'):
user_id = self._admin_client.get_user_id(email)
user_id = self._admin_client.get_user_id(username)
if user_id is None:
raise KeyError('User %s does not exist' % email)
raise KeyError('User with username %s does not exist' % username)
assert user_id is not None, 'Could not determine user from given kwargs'
......
......@@ -125,7 +125,7 @@ class TestKeycloak:
assert user.affiliation_address is not None
def test_get_user(self, keycloak):
user = infrastructure.keycloak.get_user(email='sheldon.cooper@nomad-coe.eu')
user = infrastructure.keycloak.get_user(username='scooper')
self.assert_sheldon(user)
def test_search_user(self, keycloak):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment