Permalink
Browse files

Add a test for #17914

  • Loading branch information...
1 parent 4b722b3 commit 74527ba80f5b2d9442ab88c083a7e29b6d917d01 @bradleyayers committed Jun 25, 2012
@@ -0,0 +1,14 @@
+from __future__ import absolute_import
+
+from django.conf.urls import patterns, url, include
+
+from .views import namespaced_view_class_instance
+
+deeper_patterns = patterns('',
+ (r'^view_class/$', namespaced_view_class_instance),
+)
+
+urlpatterns = patterns('regressiontests.urlpatterns_reverse.views',
+ url(r'^deeper/', include(deeper_patterns)),
+)
+
@@ -49,6 +49,8 @@ def urls(self):
(r'^ns-included[135]/', include('regressiontests.urlpatterns_reverse.included_namespace_urls', namespace='inc-ns1')),
(r'^ns-included2/', include('regressiontests.urlpatterns_reverse.included_namespace_urls', namespace='inc-ns2')),
+ (r'^ns-only-included/', include('regressiontests.urlpatterns_reverse.included_only_namespace_urls', namespace='inc-only-ns1')),
+
(r'^included/', include('regressiontests.urlpatterns_reverse.included_namespace_urls')),
(r'^inc(?P<outer>\d+)/', include('regressiontests.urlpatterns_reverse.included_urls', namespace='inc-ns5')),
@@ -278,6 +278,9 @@ def test_redirect_view_object(self):
class NamespaceTests(TestCase):
urls = 'regressiontests.urlpatterns_reverse.namespace_urls'
+ def test_function_reference(self):
+ self.assertEqual(reverse(views.namespaced_view_class_instance), '/ns-only-included/deeper/view_class/')
+
def test_ambiguous_object(self):
"Names deployed via dynamic URL objects that require namespaces can't be resolved"
self.assertRaises(NoReverseMatch, reverse, 'urlobject-view')
@@ -26,6 +26,7 @@ def __call__(self, request, *args, **kwargs):
return HttpResponse('')
view_class_instance = ViewClass()
+namespaced_view_class_instance = ViewClass()
class LazyRedirectView(RedirectView):
url = reverse_lazy('named-lazy-url-redirected-to')

0 comments on commit 74527ba

Please sign in to comment.