Ticket #13154: django-smarter-reverse-tests.patch

File django-smarter-reverse-tests.patch, 2.7 KB (added by Patryk Zawadzki, 15 years ago)

Tests, assuming that the mentioned URL can be fixed

  • tests/regressiontests/urlpatterns_reverse/views.py

     
    66
    77def absolute_kwargs_view(request, arg1=1, arg2=2):
    88    pass
     9
     10def defaults_view(request, arg1, arg2):
     11    pass
  • tests/regressiontests/urlpatterns_reverse/tests.py

     
    102102    ('kwargs_view', '/arg_view/10/', [], {'arg1':10}),
    103103    ('regressiontests.urlpatterns_reverse.views.absolute_kwargs_view', '/absolute_arg_view/', [], {}),
    104104    ('regressiontests.urlpatterns_reverse.views.absolute_kwargs_view', '/absolute_arg_view/10/', [], {'arg1':10}),
    105     ('non_path_include', '/includes/non_path_include/', [], {})
     105    ('non_path_include', '/includes/non_path_include/', [], {}),
    106106
     107    # Tests for #13154
     108    ('defaults', '/defaults_view1/3/', [], {'arg1': 3, 'arg2': 1}),
     109    ('defaults', '/defaults_view2/3/', [], {'arg1': 3, 'arg2': 2}),
     110    ('defaults', NoReverseMatch, [], {'arg1': 3, 'arg2': 3}),
     111    ('defaults', NoReverseMatch, [], {'arg2': 1}),
    107112)
    108113
    109114class URLPatternReverse(TestCase):
  • tests/regressiontests/urlpatterns_reverse/urls.py

     
    1919    url(r'^people/(?:name/)', empty_view, name="people2"),
    2020    url(r'^people/(?:name/(\w+)/)?', empty_view, name="people2a"),
    2121    url(r'^optional/(?P<name>.*)/(?:.+/)?', empty_view, name="optional"),
    22     url(r'^hardcoded/$', 'hardcoded/', empty_view, name="hardcoded"),
     22    url(r'^hardcoded/$', empty_view, name="hardcoded"),
    2323    url(r'^hardcoded/doc\.pdf$', empty_view, name="hardcoded2"),
    2424    url(r'^people/(?P<state>\w\w)/(?P<name>\w+)/$', empty_view, name="people3"),
    2525    url(r'^people/(?P<state>\w\w)/(?P<name>\d)/$', empty_view, name="people4"),
     
    5555    url(r'arg_view/(?P<arg1>\d+)/$', 'kwargs_view'),
    5656    url(r'absolute_arg_view/(?P<arg1>\d+)/$', absolute_kwargs_view),
    5757    url(r'absolute_arg_view/$', absolute_kwargs_view),
    58    
     58
     59    # Tests for #13154. Mixed syntax to test both ways of defining URLs.
     60    url(r'defaults_view1/(?P<arg1>\d+)/', 'defaults_view', {'arg2': 1}, name='defaults'),
     61    (r'defaults_view2/(?P<arg1>\d+)/', 'defaults_view', {'arg2': 2}, 'defaults'),
     62
    5963    url('^includes/', include(other_patterns)),
    6064
    6165)
Back to Top