mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #19730 -- Don't validate importability of settings by using i18n in management commands.
They are handled independently now and the latter can be influenced by the new BaseCommand.leave_locale_alone internal option. Thanks chrischambers for the report, Claude, lpiatek, neaf and gabooo for their work on a patch, originally on refs. #17379.
This commit is contained in:
@@ -44,3 +44,17 @@ class CommandTests(TestCase):
|
||||
finally:
|
||||
sys.stderr = old_stderr
|
||||
self.assertIn("CommandError", err.getvalue())
|
||||
|
||||
def test_default_en_us_locale_set(self):
|
||||
# Forces en_us when set to true
|
||||
out = StringIO()
|
||||
with translation.override('pl'):
|
||||
management.call_command('leave_locale_alone_false', stdout=out)
|
||||
self.assertEqual(out.getvalue(), "en-us\n")
|
||||
|
||||
def test_configured_locale_preserved(self):
|
||||
# Leaves locale from settings when set to false
|
||||
out = StringIO()
|
||||
with translation.override('pl'):
|
||||
management.call_command('leave_locale_alone_true', stdout=out)
|
||||
self.assertEqual(out.getvalue(), "pl\n")
|
||||
|
||||
Reference in New Issue
Block a user