Added i18n-related URL mapper test for a mailing list report.

This commit is contained in:
Ramiro Morales 2013-06-04 11:19:27 -03:00
parent 687afdaa48
commit e71b63e280
3 changed files with 13 additions and 1 deletions

View File

@ -52,8 +52,10 @@ class URLPrefixTests(URLTestCaseBase):
def test_not_prefixed(self):
with translation.override('en'):
self.assertEqual(reverse('not-prefixed'), '/not-prefixed/')
self.assertEqual(reverse('not-prefixed-included-url'), '/not-prefixed-include/foo/')
with translation.override('nl'):
self.assertEqual(reverse('not-prefixed'), '/not-prefixed/')
self.assertEqual(reverse('not-prefixed-included-url'), '/not-prefixed-include/foo/')
def test_prefixed(self):
with translation.override('en'):
@ -183,7 +185,7 @@ class URLRedirectTests(URLTestCaseBase):
class URLVaryAcceptLanguageTests(URLTestCaseBase):
"""
Tests that 'Accept-Language' is not added to the Vary header when using
prefixed URLs.
prefixed URLs.
"""
def test_no_prefix_response(self):
response = self.client.get('/not-prefixed/')

View File

@ -8,6 +8,7 @@ view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = patterns('',
url(r'^not-prefixed/$', view, name='not-prefixed'),
url(r'^not-prefixed-include/', include('i18n.patterns.urls.included')),
url(_(r'^translated/$'), view, name='no-prefix-translated'),
url(_(r'^translated/(?P<slug>[\w-]+)/$'), view, name='no-prefix-translated-slug'),
)

View File

@ -0,0 +1,9 @@
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = patterns('',
url(r'^foo/$', view, name='not-prefixed-included-url'),
)