summaryrefslogtreecommitdiff
path: root/tests/view_tests
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2014-02-18 14:46:23 +0100
committerBaptiste Mispelon <bmispelon@gmail.com>2014-02-22 13:50:12 +0100
commitcd027aaadfeac84111306ecda11ef5a0cfaacb75 (patch)
treebb36256c9eee50ed6ccaa525a5aee2b573130496 /tests/view_tests
parent578bdb532cd88333569ef3f77042653e1a9f2d9d (diff)
downloaddjango-cd027aaadfeac84111306ecda11ef5a0cfaacb75.tar.gz
Added some tests for #21725.
Diffstat (limited to 'tests/view_tests')
-rw-r--r--tests/view_tests/app5/__init__.py0
-rw-r--r--tests/view_tests/app5/locale/fr/LC_MESSAGES/djangojs.mobin0 -> 441 bytes
-rw-r--r--tests/view_tests/app5/locale/fr/LC_MESSAGES/djangojs.po20
-rw-r--r--tests/view_tests/tests/test_i18n.py11
-rw-r--r--tests/view_tests/urls.py6
5 files changed, 37 insertions, 0 deletions
diff --git a/tests/view_tests/app5/__init__.py b/tests/view_tests/app5/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/view_tests/app5/__init__.py
diff --git a/tests/view_tests/app5/locale/fr/LC_MESSAGES/djangojs.mo b/tests/view_tests/app5/locale/fr/LC_MESSAGES/djangojs.mo
new file mode 100644
index 0000000000..a5bf1c1e4f
--- /dev/null
+++ b/tests/view_tests/app5/locale/fr/LC_MESSAGES/djangojs.mo
Binary files differ
diff --git a/tests/view_tests/app5/locale/fr/LC_MESSAGES/djangojs.po b/tests/view_tests/app5/locale/fr/LC_MESSAGES/djangojs.po
new file mode 100644
index 0000000000..2bb9850245
--- /dev/null
+++ b/tests/view_tests/app5/locale/fr/LC_MESSAGES/djangojs.po
@@ -0,0 +1,20 @@
+# 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"
+
+msgid "A nice emoji: 💩"
+msgstr "Un beau caractère emoji: 💩"
diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py
index 1262ad4786..646b91f893 100644
--- a/tests/view_tests/tests/test_i18n.py
+++ b/tests/view_tests/tests/test_i18n.py
@@ -136,6 +136,17 @@ class JsI18NTests(TestCase):
response = self.client.get('/jsi18n_admin/?language=de')
self.assertContains(response, '\\x04')
+ @modify_settings(INSTALLED_APPS={'append': ['view_tests.app5']})
+ def test_non_BMP_char(self):
+ """
+ Non-BMP characters should not break the javascript_catalog (#21725).
+ """
+ with self.settings(LANGUAGE_CODE='en-us'), override('fr'):
+ response = self.client.get('/jsi18n/app5/')
+ self.assertEqual(response.status_code, 200)
+ self.assertContains(response, 'emoji')
+ self.assertContains(response, '\\ud83d\\udca9')
+
class JsI18NTestsMultiPackage(TestCase):
urls = 'view_tests.urls'
diff --git a/tests/view_tests/urls.py b/tests/view_tests/urls.py
index e3ec63c289..edf1bc56db 100644
--- a/tests/view_tests/urls.py
+++ b/tests/view_tests/urls.py
@@ -36,6 +36,11 @@ js_info_dict_admin = {
'packages': ('django.contrib.admin', 'view_tests'),
}
+js_info_dict_app5 = {
+ 'domain': 'djangojs',
+ 'packages': ('view_tests.app5',),
+}
+
urlpatterns = patterns('',
(r'^$', views.index_page),
@@ -54,6 +59,7 @@ urlpatterns = patterns('',
# i18n views
(r'^i18n/', include('django.conf.urls.i18n')),
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
+ (r'^jsi18n/app5/$', 'django.views.i18n.javascript_catalog', js_info_dict_app5),
(r'^jsi18n_english_translation/$', 'django.views.i18n.javascript_catalog', js_info_dict_english_translation),
(r'^jsi18n_multi_packages1/$', 'django.views.i18n.javascript_catalog', js_info_dict_multi_packages1),
(r'^jsi18n_multi_packages2/$', 'django.views.i18n.javascript_catalog', js_info_dict_multi_packages2),