diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-02-04 14:35:52 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2018-05-13 10:21:53 +0200 |
| commit | d65b0f72de8d35617fe0554ddabc950c7f323eef (patch) | |
| tree | 856b84e4b4200a89042ddbdd074c3015d0eda0f1 /tests | |
| parent | 1e0cbc72e5bcb1c1e235b3cd82a92800ed3c84b8 (diff) | |
Fixed #17379 -- Removed management commands deactivation of the locale.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/i18n/test_extraction.py | 4 | ||||
| -rw-r--r-- | tests/user_commands/management/commands/leave_locale_alone_true.py | 10 | ||||
| -rw-r--r-- | tests/user_commands/management/commands/no_translations.py (renamed from tests/user_commands/management/commands/leave_locale_alone_false.py) | 5 | ||||
| -rw-r--r-- | tests/user_commands/tests.py | 17 |
4 files changed, 10 insertions, 26 deletions
diff --git a/tests/i18n/test_extraction.py b/tests/i18n/test_extraction.py index b4c2ce4c9d..d9ce3b43c7 100644 --- a/tests/i18n/test_extraction.py +++ b/tests/i18n/test_extraction.py @@ -194,10 +194,6 @@ class BasicExtractorTests(ExtractorTests): self.assertMsgId("Get my line number", po_contents) self.assertLocationCommentPresent(self.PO_FILE, 'Get my line number', 'templates', 'test.html') - def test_force_en_us_locale(self): - """Value of locale-munging option used by the command is the right one""" - self.assertTrue(MakeMessagesCommand.leave_locale_alone) - def test_extraction_error(self): msg = ( 'Translation blocks must not include other block tags: blocktrans ' diff --git a/tests/user_commands/management/commands/leave_locale_alone_true.py b/tests/user_commands/management/commands/leave_locale_alone_true.py deleted file mode 100644 index 3100a2901b..0000000000 --- a/tests/user_commands/management/commands/leave_locale_alone_true.py +++ /dev/null @@ -1,10 +0,0 @@ -from django.core.management.base import BaseCommand -from django.utils import translation - - -class Command(BaseCommand): - - leave_locale_alone = True - - def handle(self, *args, **options): - return translation.get_language() diff --git a/tests/user_commands/management/commands/leave_locale_alone_false.py b/tests/user_commands/management/commands/no_translations.py index aa3e20664a..2a8af6605b 100644 --- a/tests/user_commands/management/commands/leave_locale_alone_false.py +++ b/tests/user_commands/management/commands/no_translations.py @@ -1,10 +1,9 @@ -from django.core.management.base import BaseCommand +from django.core.management.base import BaseCommand, no_translations from django.utils import translation class Command(BaseCommand): - leave_locale_alone = False - + @no_translations def handle(self, *args, **options): return translation.get_language() diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py index 61e649c75a..b5d29721b4 100644 --- a/tests/user_commands/tests.py +++ b/tests/user_commands/tests.py @@ -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): """ |
