Ticket #15900: 15900_tests_for_namespaced_urls_capturing_variables.diff

File 15900_tests_for_namespaced_urls_capturing_variables.diff, 1.8 KB (added by dmclain, 14 years ago)
  • tests/regressiontests/urlpatterns_reverse/namespace_urls.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/namespace_urls.py b/tests/regressiontests/urlpatterns_reverse/namespace_urls.py
    index e3094e6..0544e75 100644
    a b urlpatterns = patterns('regressiontests.urlpatterns_reverse.views',  
    4343    (r'^ns-included2/', include('regressiontests.urlpatterns_reverse.included_namespace_urls', namespace='inc-ns2')),
    4444
    4545    (r'^included/', include('regressiontests.urlpatterns_reverse.included_namespace_urls')),
     46    (r'^inc(?P<outer>\d+)/', include('regressiontests.urlpatterns_reverse.included_urls', namespace='inc-ns5')),
    4647
    4748)
  • tests/regressiontests/urlpatterns_reverse/tests.py

    diff --git a/tests/regressiontests/urlpatterns_reverse/tests.py b/tests/regressiontests/urlpatterns_reverse/tests.py
    index 198d556..0a339a5 100644
    a b class NamespaceTests(TestCase):  
    319319        self.assertEqual('/ns-included1/ns-included4/ns-included1/test3/inner/37/42/', reverse('inc-ns1:inc-ns4:inc-ns1:test-ns3:urlobject-view', args=[37,42]))
    320320        self.assertEqual('/ns-included1/ns-included4/ns-included1/test3/inner/42/37/', reverse('inc-ns1:inc-ns4:inc-ns1:test-ns3:urlobject-view', kwargs={'arg1':42, 'arg2':37}))
    321321
     322    def test_nested_namespace_with_variable(self):
     323        self.assertEqual('/inc54/', reverse('inc-ns5:inner-nothing', kwargs={'outer':'54'}))
     324        self.assertEqual('/inc78/extra/foobar/', reverse('inc-ns5:inner-extra', kwargs={'outer':'78', 'extra':'foobar'}))
     325
    322326    def test_app_lookup_object(self):
    323327        "A default application namespace can be used for lookup"
    324328        self.assertEqual('/default/inner/', reverse('testapp:urlobject-view'))
Back to Top