Kaydet (Commit) e71b63e2 authored tarafından Ramiro Morales's avatar Ramiro Morales

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

üst 687afdaa
...@@ -52,8 +52,10 @@ class URLPrefixTests(URLTestCaseBase): ...@@ -52,8 +52,10 @@ class URLPrefixTests(URLTestCaseBase):
def test_not_prefixed(self): def test_not_prefixed(self):
with translation.override('en'): with translation.override('en'):
self.assertEqual(reverse('not-prefixed'), '/not-prefixed/') self.assertEqual(reverse('not-prefixed'), '/not-prefixed/')
self.assertEqual(reverse('not-prefixed-included-url'), '/not-prefixed-include/foo/')
with translation.override('nl'): with translation.override('nl'):
self.assertEqual(reverse('not-prefixed'), '/not-prefixed/') self.assertEqual(reverse('not-prefixed'), '/not-prefixed/')
self.assertEqual(reverse('not-prefixed-included-url'), '/not-prefixed-include/foo/')
def test_prefixed(self): def test_prefixed(self):
with translation.override('en'): with translation.override('en'):
...@@ -183,7 +185,7 @@ class URLRedirectTests(URLTestCaseBase): ...@@ -183,7 +185,7 @@ class URLRedirectTests(URLTestCaseBase):
class URLVaryAcceptLanguageTests(URLTestCaseBase): class URLVaryAcceptLanguageTests(URLTestCaseBase):
""" """
Tests that 'Accept-Language' is not added to the Vary header when using Tests that 'Accept-Language' is not added to the Vary header when using
prefixed URLs. prefixed URLs.
""" """
def test_no_prefix_response(self): def test_no_prefix_response(self):
response = self.client.get('/not-prefixed/') response = self.client.get('/not-prefixed/')
......
...@@ -8,6 +8,7 @@ view = TemplateView.as_view(template_name='dummy.html') ...@@ -8,6 +8,7 @@ view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^not-prefixed/$', view, name='not-prefixed'), 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/$'), view, name='no-prefix-translated'),
url(_(r'^translated/(?P<slug>[\w-]+)/$'), view, name='no-prefix-translated-slug'), url(_(r'^translated/(?P<slug>[\w-]+)/$'), view, name='no-prefix-translated-slug'),
) )
......
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'),
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment