Changes between Initial Version and Version 1 of Ticket #29775, comment 1


Ignore:
Timestamp:
Sep 20, 2018, 2:23:47 AM (6 years ago)
Author:
Carlton Gibson

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29775, comment 1

    initial v1  
    77* [https://github.com/django/django/pull/9965/commits/39283c8edbc5991b589d48a8e17152042193f2df#diff-055d5f3389bf8b35e12c627956f4a33cR70 Check that it reverses correctly].
    88
     9Not attempting any reuse of the above test, this diff passes:
     10
     11{{{
     12diff --git a/tests/urlpatterns/path_base64_urls.py b/tests/urlpatterns/path_base64_urls.py
     13index 9b69f929fe..52a4045281 100644
     14--- a/tests/urlpatterns/path_base64_urls.py
     15+++ b/tests/urlpatterns/path_base64_urls.py
     16@@ -12,4 +12,5 @@ urlpatterns = [
     17     path('base64/<base64:value>/', views.empty_view, name='base64'),
     18     path('base64/<base64:base>/subpatterns/', include(subpatterns)),
     19     path('base64/<base64:base>/namespaced/', include((subpatterns, 'namespaced-base64'))),
     20+    path('base64/<base64:base>/namespaced/', include((subpatterns, 'namespaced-base64'), namespace='instance-ns-base64')),
     21 ]
     22diff --git a/tests/urlpatterns/tests.py b/tests/urlpatterns/tests.py
     23index b3d97ec5b9..f108fdfb55 100644
     24--- a/tests/urlpatterns/tests.py
     25+++ b/tests/urlpatterns/tests.py
     26@@ -70,6 +70,16 @@ class SimplifiedURLTests(SimpleTestCase):
     27                 url = reverse(url_name, kwargs=kwargs)
     28                 self.assertEqual(url, expected)
     29 
     30+    @override_settings(ROOT_URLCONF='urlpatterns.path_base64_urls')
     31+    def test_converter_reverse_with_instance_namespace(self):
     32+        expected = '/base64/aGVsbG8=/namespaced/d29ybGQ=/'
     33+        url_name = 'subpattern-base64'
     34+        instance_ns = 'instance-ns-base64'
     35+        kwargs = included_kwargs
     36+        url_name = '%s:%s' % (instance_ns, url_name)
     37+        url = reverse(url_name, kwargs=kwargs)
     38+        self.assertEqual(url, expected)
     39+
     40     def test_path_inclusion_is_matchable(self):
     41         match = resolve('/included_urls/extra/something/')
     42         self.assertEqual(match.url_name, 'inner-extra')
     43}}}
     44
    945Are you able to adjust the test case there to show your issue in action?
     46
    1047Thanks!
Back to Top