Ticket #13514: 13514-regression-test.2.diff
File 13514-regression-test.2.diff, 14.9 KB (added by , 14 years ago) |
---|
-
tests/regressiontests/admin_views/tests.py
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
a b 2 2 3 3 import re 4 4 import datetime 5 from django.conf import settings6 5 from django.core.files import temp as tempfile 7 6 from django.test import TestCase 8 7 from django.contrib.auth import admin # Register auth models with the admin. … … 16 15 from django.utils import formats 17 16 from django.utils.cache import get_max_age 18 17 from django.utils.html import escape 19 from django.utils.translation import get_date_formats, activate, deactivate20 18 from django.utils.encoding import iri_to_uri 21 19 22 20 # local test models 23 21 from models import Article, BarAccount, CustomArticle, EmptyModel, \ 24 ExternalSubscriber,FooAccount, Gallery, ModelWithStringPrimaryKey, \22 FooAccount, Gallery, ModelWithStringPrimaryKey, \ 25 23 Person, Persona, Picture, Podcast, Section, Subscriber, Vodcast, \ 26 24 Language, Collector, Widget, Grommet, DooHickey, FancyDoodad, Whatsit, \ 27 25 Category, Post, Plot, FunkyTag … … 272 270 response = self.client.get("/test_admin/admin/admin_views/post/") 273 271 self.failUnless('icon-unknown.gif' in response.content) 274 272 275 def testI18NLanguageNonEnglishDefault(self):276 """277 Check if the Javascript i18n view returns an empty language catalog278 if the default language is non-English but the selected language279 is English. See #13388 and #3594 for more details.280 """281 old_language_code = settings.LANGUAGE_CODE282 settings.LANGUAGE_CODE = 'fr'283 activate('en-us')284 response = self.client.get('/test_admin/admin/jsi18n/')285 self.assertNotContains(response, 'Choisir une heure')286 deactivate()287 settings.LANGUAGE_CODE = old_language_code288 289 def testI18NLanguageNonEnglishFallback(self):290 """291 Makes sure that the fallback language is still working properly292 in cases where the selected language cannot be found.293 """294 old_language_code = settings.LANGUAGE_CODE295 settings.LANGUAGE_CODE = 'fr'296 activate('none')297 response = self.client.get('/test_admin/admin/jsi18n/')298 self.assertContains(response, 'Choisir une heure')299 deactivate()300 settings.LANGUAGE_CODE = old_language_code301 302 273 303 274 class SaveAsTests(TestCase): 304 275 fixtures = ['admin-views-users.xml','admin-views-person.xml'] -
new file tests/regressiontests/views/app1/__init__.py
diff --git a/tests/regressiontests/views/app1/__init__.py b/tests/regressiontests/views/app1/__init__.py new file mode 100644
- + 1 # -
new file tests/regressiontests/views/app1/locale/fr/LC_MESSAGES/djangojs.mo
diff --git a/tests/regressiontests/views/app1/locale/fr/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/app1/locale/fr/LC_MESSAGES/djangojs.mo new file mode 100644 index 0000000000000000000000000000000000000000..5d6aecb446f3b0b907f540596f8268833603678b GIT binary patch literal 482 zc$`g<!A{#i5QYtEFFy9nVGg~~q281Ta8ray42o)pG;z2u_Fxu;U2AuO=!5hfIH0}+ z@6l)JSRlbjpLS;T@9e*`|2}>A6G?0fJHi*?qcDnIVlI3ZehI^^D7x=g;YsqXSIu_x zF8Ia-&|Rk>us5~^DcQjl0efx3S~E4#+`C(<8K(_ik`Kn&6z19ZXLg>$WxiNWFJ|$A zI_DY7(3%EMH*LVmr4Y|ADja*#EQfF+-BK7N$pI!usD_}9QZ?L7WJiR!pnDVE>r{ft z5Y+(GAl+A(d=p)v17r2-&G{70Rz(4`tjuAQm)W#9$tIIUzFZ!Q)V3Sl5>}+|QYf<7 z`Kq@(DvFb}*>k=<j>~D8zdcIrCGpr<CM$RR?!*Ms1Apz-+Su<<-)J9*f2^uAJbcsj zUarYwZfn=b2vaz`G8{){4cB_Z{UDo-@dPz7Q{UzJuO(<C)n3>9{OBq4W&aJ)e+vDC AssI20
-
new file tests/regressiontests/views/app1/locale/fr/LC_MESSAGES/djangojs.po
diff --git a/tests/regressiontests/views/app1/locale/fr/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/app1/locale/fr/LC_MESSAGES/djangojs.po new file mode 100644
- + 1 # SOME DESCRIPTIVE TITLE. 2 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 # This file is distributed under the same license as the PACKAGE package. 4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 5 # 6 #, fuzzy 7 msgid "" 8 msgstr "" 9 "Project-Id-Version: PACKAGE VERSION\n" 10 "Report-Msgid-Bugs-To: \n" 11 "POT-Creation-Date: 2007-09-15 19:15+0200\n" 12 "PO-Revision-Date: 2010-05-12 12:41-0300\n" 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 14 "Language-Team: LANGUAGE <LL@li.org>\n" 15 "MIME-Version: 1.0\n" 16 "Content-Type: text/plain; charset=UTF-8\n" 17 "Content-Transfer-Encoding: 8bit\n" 18 19 msgid "this app1 string is to be translated" 20 msgstr "il faut traduire cette chaîne de caractères de app1" -
new file tests/regressiontests/views/app2/__init__.py
diff --git a/tests/regressiontests/views/app2/__init__.py b/tests/regressiontests/views/app2/__init__.py new file mode 100644
- + 1 # -
new file tests/regressiontests/views/app2/locale/fr/LC_MESSAGES/djangojs.mo
diff --git a/tests/regressiontests/views/app2/locale/fr/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/app2/locale/fr/LC_MESSAGES/djangojs.mo new file mode 100644 index 0000000000000000000000000000000000000000..17e18636727c1801f37cea95e3fd15d95e2b4234 GIT binary patch literal 482 zc$`g<!A`?442BDWOOKp6_`nSUZP5gjfhb!+6YUsV$33*B1dXIhya^tJci@0{3EqQe z!4;rk=~I43e;mj8+E{z_I98cWW`|j4y53KWm@Vdp>8yC(qFtGH)+^pJR{sP&C<n4> zB5-7tu7OiBaECxvYB!UFl{d2H5la$-O5CD#%IFwIN$)DTOyM>iPX^aRe~gW>Byv}) zN}SJYCkhjTKe{eN&!QwgB>G$}hA0RQL~ta+4unT>*x3$vhmB&43+4X%!axKa5k?S2 zF^gcIeVKG5ir?Ohjp1UNWiU+g6uN1i46?JN-yf%w$thcPJ(o3#0_9T-Su(twwk>zF z>};lXjjd1pe2}NhM}@nA-!qy}^Bpe@H$nJJd(BKLeGKJ;v<~THT3m?3rLXPf9<4}q vX(}FJ42O4$d{52bUe2i<WHnb7p+q8Vt9*WFgo>rKvZT*9i>^)EZ}7eW4QGU{
-
new file tests/regressiontests/views/app2/locale/fr/LC_MESSAGES/djangojs.po
diff --git a/tests/regressiontests/views/app2/locale/fr/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/app2/locale/fr/LC_MESSAGES/djangojs.po new file mode 100644
- + 1 # SOME DESCRIPTIVE TITLE. 2 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 # This file is distributed under the same license as the PACKAGE package. 4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 5 # 6 #, fuzzy 7 msgid "" 8 msgstr "" 9 "Project-Id-Version: PACKAGE VERSION\n" 10 "Report-Msgid-Bugs-To: \n" 11 "POT-Creation-Date: 2007-09-15 19:15+0200\n" 12 "PO-Revision-Date: 2010-05-12 22:05-0300\n" 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 14 "Language-Team: LANGUAGE <LL@li.org>\n" 15 "MIME-Version: 1.0\n" 16 "Content-Type: text/plain; charset=UTF-8\n" 17 "Content-Transfer-Encoding: 8bit\n" 18 19 msgid "this app2 string is to be translated" 20 msgstr "il faut traduire cette chaîne de caractères de app2" -
tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.mo
diff --git a/tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.mo index 01c002e9e0e3878edd15a03a3d997c0e5124ef33..b6b088752a01696046502cda6205ccd9bccb6487 GIT binary patch literal 490 zc$`g;O-{ow5QSZSHj!Y#iUo_=BSTUMKLM(SHlT{6RBhTdrWsPB)-JY#;09cP>u>|E zz*(58m0;vgBU$f_pXX<1<C9UX6MMulu}P$CSr5b(A&6Z<6Jd?959-^*S8eJ0re0fl z)>eHnleH#VTLb}4&XBo@v_QvcctmhUC_5Dn3)VCG8OM%y3O+((rB)I2;?`Y!o4_dP z4?6c<ua9$W9M5bi3w~XdmghPGuXmsGmO<gj#M?A2g1YaYa{rtMAp|GUak%f(4GDQ4 zU#0!83w-W}Jg7rZk3#YskuDY1@qCp{n+R@(X$svqOW-oe;!fI(+wFcb7&J(#%1V^T za}=`((zts&TtvQ1)8<qjXj3-4tdk{wp9&6qucehkMQ^;%DTKo}cQ~I4sV-nV5yqms z8s<0r>`%AI@`Q#bYOD*X$_UOLrSn)al_f%@1WdFM3@z=|NmK|g6@o>xSaDH}Wue(G DUSfgM
-
tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.po
diff --git a/tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/locale/es/LC_MESSAGES/djangojs.po
a b 9 9 "Project-Id-Version: PACKAGE VERSION\n" 10 10 "Report-Msgid-Bugs-To: \n" 11 11 "POT-Creation-Date: 2007-09-15 16:45+0200\n" 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12 "PO-Revision-Date: 2010-05-12 12:57-0300\n" 13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 14 14 "Language-Team: LANGUAGE <LL@li.org>\n" 15 15 "MIME-Version: 1.0\n" … … 18 18 19 19 #: media/js/translate.js:1 20 20 msgid "this is to be translated" 21 msgstr "esto tiene que ser traducido" 22 No newline at end of file 21 msgstr "esto tiene que ser traducido" 22 23 24 msgid "Choose a time" 25 msgstr "Elige una hora" -
tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.mo
diff --git a/tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.mo index 4feca0b44d69463a63957c4869ca210ba7bce725..356147cf11c3f3a9765a75abba326f449f4c5bad GIT binary patch literal 484 zc$`g;OHRWu5QbA8n@B8x4GR{tM*~Tr0>VRtHlT{6RBg%{(+sImuq)d^a04#DbvOej z;4Dm`QW^QvZ;k#LkLP=1<-_AxX119FW|c|3zqn`C7{P2YnrSsW@11p>`Q-a1>lbTd zUb8gUSx>J$(b^ISaPpZvH<1?jI1LX3&In~I;i&NXMnBQmVYk3LGFEC8K|gNa#McSj zC4*u2w&xFMs*S_Uma@Rhy0n<<2>kwSj%`E2aS?X7TLjG@IK<!>!xn_cQP|oEIKxI9 z(2KPHePMt>3&SRa&FCP+V4r=dunzP2Y}!O{HA++H#aRNUNfvk0i@4JnB*Wo3TUA+$ zk}xOn96=iQu1B+xPt)|GlDpcJ=YH1BlEtUO-N0{a<w)@xZ&Mz^(W~2=Rzj*17*B+; z<jzL<6&@{ovsoU=V4}vlkgAN}=s`Mvwp{*>fm#tvs5a!u3LZu6p!(fzQA^JK08zYu AnE(I)
-
tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.po
diff --git a/tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/locale/fr/LC_MESSAGES/djangojs.po
a b 9 9 "Project-Id-Version: PACKAGE VERSION\n" 10 10 "Report-Msgid-Bugs-To: \n" 11 11 "POT-Creation-Date: 2007-09-15 19:15+0200\n" 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12 "PO-Revision-Date: 2010-05-12 12:41-0300\n" 13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 14 14 "Language-Team: LANGUAGE <LL@li.org>\n" 15 15 "MIME-Version: 1.0\n" … … 17 17 "Content-Transfer-Encoding: 8bit\n" 18 18 19 19 msgid "this is to be translated" 20 msgstr "il faut le traduire" 21 No newline at end of file 20 msgstr "il faut le traduire" 21 22 23 msgid "Choose a time" 24 msgstr "Choisir une heure" -
tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.mo
diff --git a/tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.mo b/tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.mo index 148cba533bfe58b81654c876767e3053988250f6..21659a93d3ed61229fb0d6cb100f64391ded2b28 GIT binary patch literal 489 zc$`g-&uZI15XRSOa}l(MoC@t>?qO5OjZ#PXLsVG_rjlc1+2^k9jl99pn%zxEZy~2b z4~0S>q^5!#iu(%dYY%;vjuS(&?2m64zM1{@-^TMF1kW?%4YG}_BMEsppO6;_LtY^g z@oR*9L4A$Pv3`mA7qzyUSzGCHCyB;VY7PvHxZuQ$g$BGv!hnNOtke@`_=t3rJm*70 zTO-=%N()&A&<UfD;YkerIP11f+fK%(QW=`+LX7B#%R<v!2H<o~a~dhm3=YvIZVRC9 zy6>sGOFbXFonYJFbg_d*n(-^4pZYwPx<2*l;MD^kXWpSNVcO7ql})Muj(bT0?J$jD zKTg9|auhb3S={X&qO~k8S;1+}*+l?J*gokkBkw24(L`)XRUA5LD~%sN<!!l6Bum3f zeB<*JLl}N--cBb>lzT87Go`sX=;g<>@#tG-Ipd1P<xq}9Sp?7+2;&g@eeu=)wAJFq b-Ysrz1$KsIWq&We5&P%9U)h<R+h62AFD#FK
-
tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.po
diff --git a/tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.po b/tests/regressiontests/views/locale/ru/LC_MESSAGES/djangojs.po
a b 9 9 "Project-Id-Version: PACKAGE VERSION\n" 10 10 "Report-Msgid-Bugs-To: \n" 11 11 "POT-Creation-Date: 2007-09-15 16:45+0200\n" 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12 "PO-Revision-Date: 2010-05-12 12:57-0300\n" 13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 14 14 "Language-Team: LANGUAGE <LL@li.org>\n" 15 15 "MIME-Version: 1.0\n" … … 17 17 "Content-Transfer-Encoding: 8bit\n" 18 18 19 19 msgid "this is to be translated" 20 msgstr "перевод" 21 No newline at end of file 20 msgstr "перевод" 21 22 23 msgid "Choose a time" 24 msgstr "Выберите время" -
tests/regressiontests/views/tests/i18n.py
diff --git a/tests/regressiontests/views/tests/i18n.py b/tests/regressiontests/views/tests/i18n.py
a b 1 # -*- coding:utf-8 -*- 1 2 import gettext 2 3 3 4 from django.conf import settings 4 5 from django.test import TestCase 5 from django.utils.translation import activate 6 from django.utils.translation import activate, deactivate 6 7 from django.utils.text import javascript_quote 7 8 8 9 from regressiontests.views.urls import locale_dir … … 30 31 # javascript_quote is used to be able to check unicode strings 31 32 self.assertContains(response, javascript_quote(trans_txt), 1) 32 33 34 33 35 class JsI18NTests(TestCase): 34 36 """ 35 37 Tests django views in django/views/i18n.py that need to change … … 66 68 activate('fi') 67 69 response = self.client.get('/views/jsi18n/') 68 70 self.assertContains(response, 'il faut le traduire') 71 72 def testI18NLanguageNonEnglishDefault(self): 73 """ 74 Check if the Javascript i18n view returns an empty language catalog 75 if the default language is non-English but the selected language 76 is English. See #13388 and #3594 for more details. 77 """ 78 settings.LANGUAGE_CODE = 'fr' 79 activate('en-us') 80 response = self.client.get('/views/jsi18n/') 81 self.assertNotContains(response, 'Choisir une heure') 82 deactivate() 83 84 def testI18NLanguageNonEnglishFallback(self): 85 """ 86 Makes sure that the fallback language is still working properly 87 in cases where the selected language cannot be found. 88 """ 89 settings.LANGUAGE_CODE = 'fr' 90 activate('none') 91 response = self.client.get('/views/jsi18n/') 92 self.assertContains(response, 'Choisir une heure') 93 deactivate() 94 95 96 class JsI18NTestsMultiPackage(TestCase): 97 """ 98 Tests for django views in django/views/i18n.py that need to change 99 settings.LANGUAGE_CODE and merge JS translation from several packages. 100 """ 101 VIEW_PATH = '/views/jsi18n_multiple_packages/' 102 103 def setUp(self): 104 self.old_language_code = settings.LANGUAGE_CODE 105 self.old_installed_apps = settings.INSTALLED_APPS 106 settings.INSTALLED_APPS = list(settings.INSTALLED_APPS) + ['regressiontests.views.app1', 'regressiontests.views.app2'] 107 108 def tearDown(self): 109 settings.LANGUAGE_CODE = self.old_language_code 110 settings.INSTALLED_APPS = self.old_installed_apps 111 112 def testI18NLanguageNonEnglishDefault(self): 113 """ 114 Check if the JavaScript i18n view returns a complete language catalog 115 if the default language is en-us, the selected language is available 116 and a catalog composed by djangojs domain translations of multiple 117 Python packages is requested. See #13388, #3594 and #13514 for more details. 118 """ 119 settings.LANGUAGE_CODE = 'en-us' 120 activate('fr') 121 response = self.client.get(self.VIEW_PATH) 122 #print response.content 123 self.assertContains(response, javascript_quote('il faut traduire cette chaîne de caractères de app1')) 124 deactivate() -
tests/regressiontests/views/urls.py
diff --git a/tests/regressiontests/views/urls.py b/tests/regressiontests/views/urls.py
a b 16 16 'packages': ('regressiontests.views',), 17 17 } 18 18 19 js_info_dict_multiple_packages = { 20 'domain': 'djangojs', 21 'packages': ('regressiontests.views', 'regressiontests.views.app1', 'regressiontests.views.app2'), 22 } 23 19 24 date_based_info_dict = { 20 25 'queryset': Article.objects.all(), 21 26 'date_field': 'date_created', … … 36 41 # i18n views 37 42 (r'^i18n/', include('django.conf.urls.i18n')), 38 43 (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), 44 (r'^jsi18n_multiple_packages/$', 'django.views.i18n.javascript_catalog', js_info_dict_multiple_packages), 39 45 40 46 # Static views 41 47 (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': media_dir}),