summaryrefslogtreecommitdiff
path: root/tests/utils_tests
diff options
context:
space:
mode:
authorBouke Haarsma <bouke@webatoom.nl>2013-11-02 10:28:22 +0100
committerBouke Haarsma <bouke@webatoom.nl>2013-11-02 10:29:07 +0100
commitc3936c0d79d79aced25ceba8beff0c91a6b5c2ed (patch)
tree56d78bc607633365059a9e7b3a99ed7ce5f200f6 /tests/utils_tests
parent090315f5dfb9b0a6539daaec6cb88ad93e6e77af (diff)
Fixed #9523 -- Restart runserver after translation MO files change
Thanks to Krzysztof Kulewski for the initial patch.
Diffstat (limited to 'tests/utils_tests')
-rw-r--r--tests/utils_tests/locale/nl/LC_MESSAGES/django.mobin0 -> 367 bytes
-rw-r--r--tests/utils_tests/locale/nl/LC_MESSAGES/django.po17
-rw-r--r--tests/utils_tests/test_autoreload.py37
3 files changed, 54 insertions, 0 deletions
diff --git a/tests/utils_tests/locale/nl/LC_MESSAGES/django.mo b/tests/utils_tests/locale/nl/LC_MESSAGES/django.mo
new file mode 100644
index 0000000000..3ead8f2a31
--- /dev/null
+++ b/tests/utils_tests/locale/nl/LC_MESSAGES/django.mo
Binary files differ
diff --git a/tests/utils_tests/locale/nl/LC_MESSAGES/django.po b/tests/utils_tests/locale/nl/LC_MESSAGES/django.po
new file mode 100644
index 0000000000..6633f12b39
--- /dev/null
+++ b/tests/utils_tests/locale/nl/LC_MESSAGES/django.po
@@ -0,0 +1,17 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2007-09-15 19:15+0200\n"
+"PO-Revision-Date: 2010-05-12 12:41-0300\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
new file mode 100644
index 0000000000..3843ecafb4
--- /dev/null
+++ b/tests/utils_tests/test_autoreload.py
@@ -0,0 +1,37 @@
+import os
+
+from django import conf
+from django.test import TestCase, override_settings
+from django.utils.autoreload import gen_filenames
+
+LOCALE_PATH = os.path.join(os.path.dirname(__file__), 'locale')
+
+
+class TestFilenameGenerator(TestCase):
+ def test_django_locales(self):
+ """
+ Test that gen_filenames() also yields the built-in django locale files.
+ """
+ filenames = list(gen_filenames())
+ locales = []
+
+ basedir = os.path.join(os.path.dirname(conf.__file__), 'locale')
+ for dirpath, dirnames, locale_filenames in os.walk(basedir):
+ for filename in locale_filenames:
+ if filename.endswith('.mo'):
+ locales.append(os.path.join(dirpath, filename))
+
+ self.assertTrue(len(locales) > 10) # assume a few available locales
+ for filename in locales:
+ self.assertIn(filename, filenames)
+
+ @override_settings(
+ LOCALE_PATHS=(LOCALE_PATH,)
+ )
+ def test_app_locales(self):
+ """
+ Test that gen_filenames also yields from LOCALE_PATHS.
+ """
+ filenames = list(gen_filenames())
+ self.assertIn(os.path.join(LOCALE_PATH, 'nl', 'LC_MESSAGES', 'django.mo'),
+ filenames)