Add more test coverage

This commit is contained in:
Matt Wright
2012-08-14 14:18:20 -04:00
parent 58e2856612
commit 404e797cd9
2 changed files with 3 additions and 17 deletions
+1 -15
View File
@@ -237,9 +237,6 @@ class Security(object):
state = self._get_state(app, datastore or self.datastore)
if not hasattr(app, 'extensions'):
app.extensions = {}
app.extensions['security'] = state
return state
@@ -314,12 +311,8 @@ class AuthenticationProvider(object):
try:
user = self._get_user(username_or_email)
except AttributeError, e:
self.auth_error("Could not find user datastore: %s" % e)
except exceptions.UserNotFoundError, e:
except exceptions.UserNotFoundError:
raise exceptions.BadCredentialsError("Specified user does not exist")
except Exception, e:
self.auth_error('Unexpected authentication error: %s' % e)
if requires_confirmation(user):
raise exceptions.BadCredentialsError('Account requires confirmation')
@@ -332,10 +325,3 @@ class AuthenticationProvider(object):
# bad match
raise exceptions.BadCredentialsError("Password does not match")
def auth_error(self, msg):
"""Sends an error log message and raises an authentication error.
:param msg: An authentication error message"""
current_app.logger.error(msg)
raise exceptions.AuthenticationError(msg)
+2 -2
View File
@@ -132,10 +132,10 @@ def register_user():
def send_confirmation():
form = ResendConfirmationForm()
form = ResendConfirmationForm(csrf_enabled=not app.testing)
if form.validate_on_submit():
user = _datastore.find_user(email=form.email.data)
user = _datastore.find_user(**form.to_dict())
reset_confirmation_token(user)