Skip to content

Commit

Permalink
[1.0.X] Fixed #8752 -- Fixed django.contrib.auth tests to be locale-i…
Browse files Browse the repository at this point in the history
…ndependent.

Patch from Koen Biermans.

Backport of r10599 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10600 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Apr 19, 2009
1 parent ecb3906 commit 1c925f6
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion django/contrib/auth/tests/views.py
Expand Up @@ -15,6 +15,10 @@ class AuthViewsTestCase(TestCase):
urls = 'django.contrib.auth.urls' urls = 'django.contrib.auth.urls'


def setUp(self): def setUp(self):
self.old_LANGUAGES = settings.LANGUAGES
self.old_LANGUAGE_CODE = settings.LANGUAGE_CODE
settings.LANGUAGES = (('en', 'English'),)
settings.LANGUAGE_CODE = 'en'
self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS
settings.TEMPLATE_DIRS = ( settings.TEMPLATE_DIRS = (
os.path.join( os.path.join(
Expand All @@ -24,10 +28,22 @@ def setUp(self):
,) ,)


def tearDown(self): def tearDown(self):
settings.LANGUAGES = self.old_LANGUAGES
settings.LANGUAGE_CODE = self.old_LANGUAGE_CODE
settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS


class PasswordResetTest(AuthViewsTestCase): class PasswordResetTest(AuthViewsTestCase):


def setUp(self):
self.old_LANGUAGES = settings.LANGUAGES
self.old_LANGUAGE_CODE = settings.LANGUAGE_CODE
settings.LANGUAGES = (('en', 'English'),)
settings.LANGUAGE_CODE = 'en'

def tearDown(self):
settings.LANGUAGES = self.old_LANGUAGES
settings.LANGUAGE_CODE = self.old_LANGUAGE_CODE

def test_email_not_found(self): def test_email_not_found(self):
"Error is raised if the provided email address isn't currently registered" "Error is raised if the provided email address isn't currently registered"
response = self.client.get('/password_reset/') response = self.client.get('/password_reset/')
Expand Down Expand Up @@ -221,4 +237,4 @@ def test_logout_with_custom_redirect_argument(self):
response = self.client.get('/logout/custom_query/?follow=/somewhere/') response = self.client.get('/logout/custom_query/?follow=/somewhere/')
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
self.assert_(response['Location'].endswith('/somewhere/')) self.assert_(response['Location'].endswith('/somewhere/'))
self.confirm_logged_out() self.confirm_logged_out()

0 comments on commit 1c925f6

Please sign in to comment.