Ticket #24013: 24013-test.diff

File 24013-test.diff, 923 bytes (added by Tim Graham, 10 years ago)
  • tests/urlpatterns_reverse/tests.py

    diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py
    index 18299fe..8175985 100644
    a b class URLPatternReverse(TestCase):  
    222222            # exception
    223223            self.fail("Expected a NoReverseMatch, but none occurred.")
    224224
     225    def test_script_name_escaping(self):
     226        from django.core.urlresolvers import get_script_prefix, set_script_prefix
     227        old_prefix = get_script_prefix()
     228        set_script_prefix('/script:name/')
     229        try:
     230            self.assertEqual(
     231                reverse('optional', args=['foo:bar']),
     232                '/script:name/optional/foo:bar/',
     233            )
     234        finally:
     235            set_script_prefix(old_prefix)
     236
    225237    def test_reverse_returns_unicode(self):
    226238        name, expected, args, kwargs = test_data[0]
    227239        self.assertIsInstance(
Back to Top