Captured logging in DebugViewTests with assertLogs().
@@ -250,11 +250,13 @@ class DebugViewTests(SimpleTestCase):
self.assertContains(response, 'Page not found', status_code=404)
def test_exception_reporter_from_request(self):
+ 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):
+ with self.assertLogs('django.request', 'ERROR'):
response = self.client.get('/raises500/')
self.assertContains(response, 'custom traceback text', status_code=500)
