Fix formatting of error
Makes it more readable (rather than a repr string)
This commit is contained in:
committed by
Michael Terry
parent
924dd18f2b
commit
97a938ccd5
@@ -657,8 +657,10 @@ def _validate_password(password, username=None):
|
||||
_validate_type(password, basestring, accounts.PASSWORD_BAD_TYPE_MSG)
|
||||
|
||||
validate_password(password, username=username)
|
||||
except (errors.AccountDataBadType, ValidationError) as invalid_password_err:
|
||||
except errors.AccountDataBadType as invalid_password_err:
|
||||
raise errors.AccountPasswordInvalid(text_type(invalid_password_err))
|
||||
except ValidationError as validation_err:
|
||||
raise errors.AccountPasswordInvalid(validation_err.message)
|
||||
|
||||
|
||||
def _validate_country(country):
|
||||
|
||||
@@ -175,7 +175,7 @@ class RegistrationValidationViewTests(test_utils.ApiTestCase):
|
||||
msg = u'Password: Invalid Length (must be {0} characters or more)'.format(password_min_length())
|
||||
self.assertValidationDecision(
|
||||
{'password': ''},
|
||||
{"password": text_type([msg])}
|
||||
{"password": msg}
|
||||
)
|
||||
|
||||
def test_password_bad_min_length_validation_decision(self):
|
||||
@@ -183,7 +183,7 @@ class RegistrationValidationViewTests(test_utils.ApiTestCase):
|
||||
msg = u'Password: Invalid Length (must be {0} characters or more)'.format(password_min_length())
|
||||
self.assertValidationDecision(
|
||||
{'password': password},
|
||||
{"password": text_type([msg])}
|
||||
{"password": msg}
|
||||
)
|
||||
|
||||
def test_password_bad_max_length_validation_decision(self):
|
||||
@@ -191,11 +191,11 @@ class RegistrationValidationViewTests(test_utils.ApiTestCase):
|
||||
msg = u'Password: Invalid Length (must be {0} characters or fewer)'.format(password_max_length())
|
||||
self.assertValidationDecision(
|
||||
{'password': password},
|
||||
{"password": text_type([msg])}
|
||||
{"password": msg}
|
||||
)
|
||||
|
||||
def test_password_equals_username_validation_decision(self):
|
||||
self.assertValidationDecision(
|
||||
{"username": "somephrase", "password": "somephrase"},
|
||||
{"username": "", "password": text_type([u"Password cannot be the same as the username"])}
|
||||
{"username": "", "password": u"Password cannot be the same as the username"}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user