mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #11118 -- Made management command BaseCommand restore locale after execution.
Thanks rvdrijst for the report and initial patch and Claude Paroz for enhancing it. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17077 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -3,6 +3,7 @@ from StringIO import StringIO
|
||||
from django.core import management
|
||||
from django.core.management.base import CommandError
|
||||
from django.test import TestCase
|
||||
from django.utils import translation
|
||||
|
||||
|
||||
class CommandTests(TestCase):
|
||||
@@ -18,5 +19,11 @@ class CommandTests(TestCase):
|
||||
self.assertEqual(out.getvalue(),
|
||||
"I don't feel like dancing Jive.")
|
||||
|
||||
def test_language_preserved(self):
|
||||
out = StringIO()
|
||||
with translation.override('fr'):
|
||||
management.call_command('dance', stdout=out)
|
||||
self.assertEqual(translation.get_language(), 'fr')
|
||||
|
||||
def test_explode(self):
|
||||
self.assertRaises(CommandError, management.call_command, ('explode',))
|
||||
self.assertRaises(CommandError, management.call_command, ('explode',))
|
||||
|
||||
Reference in New Issue
Block a user