mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Captured logging in DebugViewTests with assertLogs().
This commit is contained in:
parent
b7795d7673
commit
94d1d4a71b
@ -250,12 +250,14 @@ class DebugViewTests(SimpleTestCase):
|
||||
self.assertContains(response, 'Page not found', status_code=404)
|
||||
|
||||
def test_exception_reporter_from_request(self):
|
||||
response = self.client.get('/custom_reporter_class_view/')
|
||||
with self.assertLogs('django.request', 'ERROR'):
|
||||
response = self.client.get('/custom_reporter_class_view/')
|
||||
self.assertContains(response, 'custom traceback text', status_code=500)
|
||||
|
||||
@override_settings(DEFAULT_EXCEPTION_REPORTER='view_tests.views.CustomExceptionReporter')
|
||||
def test_exception_reporter_from_settings(self):
|
||||
response = self.client.get('/raises500/')
|
||||
with self.assertLogs('django.request', 'ERROR'):
|
||||
response = self.client.get('/raises500/')
|
||||
self.assertContains(response, 'custom traceback text', status_code=500)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user