Skip to content

Commit

Permalink
Corrected tests depending on the error message on the AuthenticationF…
Browse files Browse the repository at this point in the history
…orm.

Refs #19368, and the fix introduced in 27f8129.
  • Loading branch information
freakboy3742 committed Dec 15, 2012
1 parent 27f8129 commit 9facca2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion django/contrib/auth/tests/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def test_invalid_username(self):
form = AuthenticationForm(None, data)
self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(),
[force_text(form.error_messages['invalid_login'])])
[force_text(form.error_messages['invalid_login'] % {
'username': User._meta.get_field('username').verbose_name
})])

def test_inactive_user(self):
# The user is inactive.
Expand Down
4 changes: 3 additions & 1 deletion django/contrib/auth/tests/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ def fail_login(self, password='password'):
'username': 'testclient',
'password': password,
})
self.assertContainsEscaped(response, AuthenticationForm.error_messages['invalid_login'])
self.assertContainsEscaped(response, AuthenticationForm.error_messages['invalid_login'] % {
'username': User._meta.get_field('username').verbose_name
})

def logout(self):
response = self.client.get('/logout/')
Expand Down
2 changes: 1 addition & 1 deletion tests/regressiontests/admin_views/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@


ERROR_MESSAGE = "Please enter the correct username and password \
for a staff account. Note that both fields are case-sensitive."
for a staff account. Note that both fields may be case-sensitive."


@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
Expand Down

0 comments on commit 9facca2

Please sign in to comment.