Ticket #17914: 17914-test.patch
File 17914-test.patch, 2.5 KB (added by , 13 years ago) |
---|
-
tests/regressiontests/urlpatterns_reverse/views.py
26 26 return HttpResponse('') 27 27 28 28 view_class_instance = ViewClass() 29 view_class_instance2 = ViewClass() 29 30 30 31 class LazyRedirectView(RedirectView): 31 32 url = reverse_lazy('named-lazy-url-redirected-to') -
tests/regressiontests/urlpatterns_reverse/tests.py
278 278 class NamespaceTests(TestCase): 279 279 urls = 'regressiontests.urlpatterns_reverse.namespace_urls' 280 280 281 def test_function_reference(self): 282 self.assertEqual('/included/view_class/level2/', reverse(views.view_class_instance2)) 283 281 284 def test_ambiguous_object(self): 282 285 "Names deployed via dynamic URL objects that require namespaces can't be resolved" 283 286 self.assertRaises(NoReverseMatch, reverse, 'urlobject-view') -
tests/regressiontests/urlpatterns_reverse/included_namespace_urls.py
3 3 from django.conf.urls import patterns, url, include 4 4 5 5 from .namespace_urls import URLObject 6 from .views import view_class_instance 6 from .views import view_class_instance, view_class_instance2 7 7 8 8 9 9 testobj3 = URLObject('testapp', 'test-ns3') 10 10 11 level2_patterns = patterns("", 12 (r'^level2/$', view_class_instance2) 13 ) 14 11 15 urlpatterns = patterns('regressiontests.urlpatterns_reverse.views', 12 16 url(r'^normal/$', 'empty_view', name='inc-normal-view'), 13 17 url(r'^normal/(?P<arg1>\d+)/(?P<arg2>\d+)/$', 'empty_view', name='inc-normal-view'), … … 18 22 url(r'^no_kwargs/(\d+)/(\d+)/$', 'empty_view', name='inc-no-kwargs'), 19 23 20 24 url(r'^view_class/(?P<arg1>\d+)/(?P<arg2>\d+)/$', view_class_instance, name='inc-view-class'), 25 url(r'^view_class/level2/$', include(level2_patterns)), 21 26 22 27 (r'^test3/', include(testobj3.urls)), 23 28 (r'^ns-included3/', include('regressiontests.urlpatterns_reverse.included_urls', namespace='inc-ns3')),