1
0
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:
kakwa 2015-07-31 22:54:21 +02:00
parent 64f34e3466
commit ecbf112677
2 changed files with 4 additions and 1 deletions

View File

@ -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',

View File

@ -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: