Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
02179525
Commit
02179525
authored
Jan 16, 2020
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nomad/infrastructure.py
View file @
02179525
...
...
@@ -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'
...
...
tests/app/test_api.py
View file @
02179525
...
...
@@ -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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment