1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Completed test coverage for BaseHandler.process_exception_by_middleware().

This commit is contained in:
Mariusz Felisiak 2020-03-11 12:13:15 +01:00
parent 3c35825009
commit 35c7fe8334

View File

@ -86,6 +86,15 @@ class MiddlewareTests(SimpleTestCase):
self.assertEqual(mw.log, [])
self.assertEqual(response.content, b'Exception caught')
@override_settings(MIDDLEWARE=[
'middleware_exceptions.middleware.ProcessExceptionMiddleware',
'middleware_exceptions.middleware.ProcessExceptionLogMiddleware',
])
def test_response_from_process_exception_when_return_response(self):
response = self.client.get('/middleware_exceptions/error/')
self.assertEqual(mw.log, ['process-exception'])
self.assertEqual(response.content, b'Exception caught')
@override_settings(MIDDLEWARE=[
'middleware_exceptions.middleware.LogMiddleware',
'middleware_exceptions.middleware.NotFoundMiddleware',