1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #33396 -- Added view name to technical 500 debug page.

This commit is contained in:
Hrushikesh Vaidya
2022-01-06 19:52:57 +05:30
committed by Mariusz Felisiak
parent 4099e6e737
commit 6815da6e94
6 changed files with 51 additions and 0 deletions

View File

@@ -199,6 +199,40 @@ class DebugViewTests(SimpleTestCase):
html=True,
)
def test_technical_500(self):
with self.assertLogs('django.request', 'ERROR'):
response = self.client.get('/raises500/')
self.assertContains(
response,
'<th>Raised during:</th><td>view_tests.views.raises500</td>',
status_code=500,
html=True,
)
with self.assertLogs('django.request', 'ERROR'):
response = self.client.get('/raises500/', HTTP_ACCEPT='text/plain')
self.assertContains(
response,
'Raised during: view_tests.views.raises500',
status_code=500,
)
def test_classbased_technical_500(self):
with self.assertLogs('django.request', 'ERROR'):
response = self.client.get('/classbased500/')
self.assertContains(
response,
'<th>Raised during:</th><td>view_tests.views.Raises500View</td>',
status_code=500,
html=True,
)
with self.assertLogs('django.request', 'ERROR'):
response = self.client.get('/classbased500/', HTTP_ACCEPT='text/plain')
self.assertContains(
response,
'Raised during: view_tests.views.Raises500View',
status_code=500,
)
def test_non_l10ned_numeric_ids(self):
"""
Numeric IDs and fancy traceback context blocks line numbers shouldn't be localized.