Refs #9847 -- Added tests for handler403 resolution.

This commit is contained in:
Adam Johnson 2024-03-04 04:24:36 +00:00 committed by GitHub
parent 71d5eafb05
commit c187417611
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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"

View File

@ -5,5 +5,6 @@ from .views import empty_view
urlpatterns = []
handler400 = empty_view
handler403 = empty_view
handler404 = empty_view
handler500 = empty_view