From cd027aaadfeac84111306ecda11ef5a0cfaacb75 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Tue, 18 Feb 2014 14:46:23 +0100 Subject: [PATCH] Added some tests for #21725. --- tests/view_tests/app5/__init__.py | 0 .../app5/locale/fr/LC_MESSAGES/djangojs.mo | Bin 0 -> 441 bytes .../app5/locale/fr/LC_MESSAGES/djangojs.po | 20 ++++++++++++++++++ tests/view_tests/tests/test_i18n.py | 11 ++++++++++ tests/view_tests/urls.py | 6 ++++++ 5 files changed, 37 insertions(+) create mode 100644 tests/view_tests/app5/__init__.py create mode 100644 tests/view_tests/app5/locale/fr/LC_MESSAGES/djangojs.mo create mode 100644 tests/view_tests/app5/locale/fr/LC_MESSAGES/djangojs.po diff --git a/tests/view_tests/app5/__init__.py b/tests/view_tests/app5/__init__.py new file mode 100644 index 0000000000..e69de29bb2 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 0000000000000000000000000000000000000000..a5bf1c1e4f7ccf977a46dca1a98d0cc1598b59b8 GIT binary patch literal 441 zcmY+A!A=4(5QbNympytmX6`z;ixQzCVTFZk+y#V%ds*sQ0xjtlqpxA&#fw*c4&TFP z@DUt5Nc__;(=`7~|Mu%(@5LeQ5{JYIu}{>AjRwR4aZ6No9A`%LhTLqwG zCO|CpTr&86d;V|+M$biNF`D5-m_lmBU=Xx!f^Gejc(awiOiD$_Hm aat76@w5~H&Fco|a88, 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 \n" +"Language-Team: LANGUAGE \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),