Completed test coverage for BaseHandler.process_exception_by_middleware().
@@ -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',
