summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2012-12-16 07:18:45 +0800
committerRussell Keith-Magee <russell@keith-magee.com>2012-12-16 07:22:25 +0800
commit06b5f5fcb6db2fc20e2d455a34f3f4b0293cfd8c (patch)
treef210d5ea944ea4905f06b9e0af71df1a3d5975a9
parent55aae4b86319cb95f6fab6dddbb1bd94e7f1994c (diff)
[1.5.X] Corrected tests depending on the error message on the AuthenticationForm.
Refs #19368, and the fix introduced in 27f8129d64292868f6a328f7bf9a1bed67967ff3. Backport of 9facca28b619ad94680cf07774ee7a377034ca42 from trunk.
-rw-r--r--django/contrib/auth/tests/forms.py4
-rw-r--r--django/contrib/auth/tests/views.py4
-rw-r--r--tests/regressiontests/admin_views/tests.py2
3 files changed, 7 insertions, 3 deletions
diff --git a/django/contrib/auth/tests/forms.py b/django/contrib/auth/tests/forms.py
index 25890683e8..a9f894905a 100644
--- a/django/contrib/auth/tests/forms.py
+++ b/django/contrib/auth/tests/forms.py
@@ -100,7 +100,9 @@ class AuthenticationFormTest(TestCase):
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.
diff --git a/django/contrib/auth/tests/views.py b/django/contrib/auth/tests/views.py
index 0e83ca40a2..6040a2f5b5 100644
--- a/django/contrib/auth/tests/views.py
+++ b/django/contrib/auth/tests/views.py
@@ -248,7 +248,9 @@ class ChangePasswordTest(AuthViewsTestCase):
'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/')
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index 18075dff34..d7f36c08b6 100644
--- a/tests/regressiontests/admin_views/tests.py
+++ b/tests/regressiontests/admin_views/tests.py
@@ -51,7 +51,7 @@ from .models import (Article, BarAccount, CustomArticle, EmptyModel, FooAccount,
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',))