From c1874176114cd94efcc58e3c449f4e2a116881a1 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 4 Mar 2024 04:24:36 +0000 Subject: [PATCH] Refs #9847 -- Added tests for handler403 resolution. --- tests/urlpatterns_reverse/tests.py | 6 +++--- tests/urlpatterns_reverse/urls_error_handlers.py | 1 + tests/urlpatterns_reverse/urls_error_handlers_callables.py | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py index 8384f55b3c5..5843382a8c5 100644 --- a/tests/urlpatterns_reverse/tests.py +++ b/tests/urlpatterns_reverse/tests.py @@ -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 diff --git a/tests/urlpatterns_reverse/urls_error_handlers.py b/tests/urlpatterns_reverse/urls_error_handlers.py index 7261a97e07f..d483864f4b1 100644 --- a/tests/urlpatterns_reverse/urls_error_handlers.py +++ b/tests/urlpatterns_reverse/urls_error_handlers.py @@ -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" diff --git a/tests/urlpatterns_reverse/urls_error_handlers_callables.py b/tests/urlpatterns_reverse/urls_error_handlers_callables.py index 4a8d35116e5..614fc460fc6 100644 --- a/tests/urlpatterns_reverse/urls_error_handlers_callables.py +++ b/tests/urlpatterns_reverse/urls_error_handlers_callables.py @@ -5,5 +5,6 @@ from .views import empty_view urlpatterns = [] handler400 = empty_view +handler403 = empty_view handler404 = empty_view handler500 = empty_view