fix: Add names to the error page urls.
Some of the static_template_view tests use names to get the URLs for the error pages for testing, so I added names and updated the test to match the new names. I also updated the `test_404` function because we're no longer rendering the 404 page in a different way from the 500 page so the response includes the correct response code and content type. This reduces the number of differences between the 404 handler and the 500 handler.
This commit is contained in:
@@ -67,16 +67,16 @@ class MarketingSiteViewTests(TestCase):
|
||||
"""
|
||||
Test the 404 view.
|
||||
"""
|
||||
url = reverse('static_template_view.views.render_404')
|
||||
url = reverse('render_404')
|
||||
resp = self.client.get(url)
|
||||
assert resp.status_code == 200
|
||||
assert resp['Content-Type'] == 'text/html'
|
||||
assert resp.status_code == 404
|
||||
assert resp['Content-Type'] == 'text/html; charset=utf-8'
|
||||
|
||||
def test_500(self):
|
||||
"""
|
||||
Test the 500 view.
|
||||
"""
|
||||
url = reverse('static_template_view.views.render_500')
|
||||
url = reverse('render_500')
|
||||
resp = self.client.get(url)
|
||||
assert resp.status_code == 500
|
||||
assert resp['Content-Type'] == 'text/html; charset=utf-8'
|
||||
|
||||
@@ -216,10 +216,10 @@ urlpatterns = [
|
||||
namespace='api_discounts')),
|
||||
|
||||
# Provide URLs where we can see the rendered error pages without having to force an error.
|
||||
path('403', handler403),
|
||||
path('404', handler404),
|
||||
path('429', handler429),
|
||||
path('500', handler500),
|
||||
path('403', handler403, name='render_403'),
|
||||
path('404', handler404, name='render_404'),
|
||||
path('429', handler429, name='render_429'),
|
||||
path('500', handler500, name='render_500'),
|
||||
]
|
||||
|
||||
if settings.FEATURES.get('ENABLE_MOBILE_REST_API'):
|
||||
|
||||
Reference in New Issue
Block a user