mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #17379 -- Removed management commands deactivation of the locale.
This commit is contained in:
parent
1e0cbc72e5
commit
d65b0f72de
16 changed files with 72 additions and 127 deletions
|
@ -63,17 +63,16 @@ class CommandTests(SimpleTestCase):
|
|||
dance.Command.requires_system_checks = True
|
||||
self.assertIn("CommandError", stderr.getvalue())
|
||||
|
||||
def test_deactivate_locale_set(self):
|
||||
# Deactivate translation when set to true
|
||||
def test_no_translations_deactivate_translations(self):
|
||||
"""
|
||||
When the Command handle method is decorated with @no_translations,
|
||||
translations are deactivated inside the command.
|
||||
"""
|
||||
current_locale = translation.get_language()
|
||||
with translation.override('pl'):
|
||||
result = management.call_command('leave_locale_alone_false', stdout=StringIO())
|
||||
result = management.call_command('no_translations', stdout=StringIO())
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_configured_locale_preserved(self):
|
||||
# Leaves locale from settings when set to false
|
||||
with translation.override('pl'):
|
||||
result = management.call_command('leave_locale_alone_true', stdout=StringIO())
|
||||
self.assertEqual(result, "pl")
|
||||
self.assertEqual(translation.get_language(), current_locale)
|
||||
|
||||
def test_find_command_without_PATH(self):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue