mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 01:14:21 +01:00
fix unit test on duplicate user exception
This commit is contained in:
parent
64f34e3466
commit
ecbf112677
@ -74,6 +74,7 @@ def exception_decorator(func):
|
||||
except cherrypy.HTTPError as e:
|
||||
raise e
|
||||
except Exception as e:
|
||||
cherrypy.response.status = 500
|
||||
self._handle_exception(e)
|
||||
username = self._check_session()
|
||||
if not username:
|
||||
@ -89,6 +90,7 @@ def exception_decorator(func):
|
||||
)
|
||||
elif et is UserAlreadyExists:
|
||||
user = e.user
|
||||
cherrypy.response.status = 400
|
||||
return self.temp_error.render(
|
||||
is_admin=is_admin,
|
||||
alert='warning',
|
||||
@ -1097,6 +1099,7 @@ class LdapCherry(object):
|
||||
display_names[r] = self.roles.flatten[r]['display_name']
|
||||
user_attrs = self._get_user(user)
|
||||
if user_attrs == {}:
|
||||
cherrypy.response.status = 400
|
||||
return self.temp_error.render(
|
||||
is_admin=is_admin,
|
||||
alert='warning',
|
||||
|
@ -217,7 +217,7 @@ class TestError(object):
|
||||
try:
|
||||
inv.add_user(user)
|
||||
inv.add_user(user)
|
||||
except ldap.ALREADY_EXISTS:
|
||||
except UserAlreadyExists:
|
||||
inv.del_user('test')
|
||||
return
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user