mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-25 18:54:29 +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:
|
except cherrypy.HTTPError as e:
|
||||||
raise e
|
raise e
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
cherrypy.response.status = 500
|
||||||
self._handle_exception(e)
|
self._handle_exception(e)
|
||||||
username = self._check_session()
|
username = self._check_session()
|
||||||
if not username:
|
if not username:
|
||||||
@ -89,6 +90,7 @@ def exception_decorator(func):
|
|||||||
)
|
)
|
||||||
elif et is UserAlreadyExists:
|
elif et is UserAlreadyExists:
|
||||||
user = e.user
|
user = e.user
|
||||||
|
cherrypy.response.status = 400
|
||||||
return self.temp_error.render(
|
return self.temp_error.render(
|
||||||
is_admin=is_admin,
|
is_admin=is_admin,
|
||||||
alert='warning',
|
alert='warning',
|
||||||
@ -1097,6 +1099,7 @@ class LdapCherry(object):
|
|||||||
display_names[r] = self.roles.flatten[r]['display_name']
|
display_names[r] = self.roles.flatten[r]['display_name']
|
||||||
user_attrs = self._get_user(user)
|
user_attrs = self._get_user(user)
|
||||||
if user_attrs == {}:
|
if user_attrs == {}:
|
||||||
|
cherrypy.response.status = 400
|
||||||
return self.temp_error.render(
|
return self.temp_error.render(
|
||||||
is_admin=is_admin,
|
is_admin=is_admin,
|
||||||
alert='warning',
|
alert='warning',
|
||||||
|
@ -217,7 +217,7 @@ class TestError(object):
|
|||||||
try:
|
try:
|
||||||
inv.add_user(user)
|
inv.add_user(user)
|
||||||
inv.add_user(user)
|
inv.add_user(user)
|
||||||
except ldap.ALREADY_EXISTS:
|
except UserAlreadyExists:
|
||||||
inv.del_user('test')
|
inv.del_user('test')
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user