mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Refs #9847 -- Added tests for handler403 resolution.
This commit is contained in:
parent
71d5eafb05
commit
c187417611
@ -1456,7 +1456,7 @@ class RequestURLconfTests(SimpleTestCase):
|
||||
|
||||
|
||||
class ErrorHandlerResolutionTests(SimpleTestCase):
|
||||
"""Tests for handler400, handler404 and handler500"""
|
||||
"""Tests for handler400, handler403, handler404 and handler500"""
|
||||
|
||||
def setUp(self):
|
||||
urlconf = "urlpatterns_reverse.urls_error_handlers"
|
||||
@ -1465,12 +1465,12 @@ class ErrorHandlerResolutionTests(SimpleTestCase):
|
||||
self.callable_resolver = URLResolver(RegexPattern(r"^$"), urlconf_callables)
|
||||
|
||||
def test_named_handlers(self):
|
||||
for code in [400, 404, 500]:
|
||||
for code in [400, 403, 404, 500]:
|
||||
with self.subTest(code=code):
|
||||
self.assertEqual(self.resolver.resolve_error_handler(code), empty_view)
|
||||
|
||||
def test_callable_handlers(self):
|
||||
for code in [400, 404, 500]:
|
||||
for code in [400, 403, 404, 500]:
|
||||
with self.subTest(code=code):
|
||||
self.assertEqual(
|
||||
self.callable_resolver.resolve_error_handler(code), empty_view
|
||||
|
@ -3,5 +3,6 @@
|
||||
urlpatterns = []
|
||||
|
||||
handler400 = "urlpatterns_reverse.views.empty_view"
|
||||
handler403 = "urlpatterns_reverse.views.empty_view"
|
||||
handler404 = "urlpatterns_reverse.views.empty_view"
|
||||
handler500 = "urlpatterns_reverse.views.empty_view"
|
||||
|
@ -5,5 +5,6 @@ from .views import empty_view
|
||||
urlpatterns = []
|
||||
|
||||
handler400 = empty_view
|
||||
handler403 = empty_view
|
||||
handler404 = empty_view
|
||||
handler500 = empty_view
|
||||
|
Loading…
Reference in New Issue
Block a user