1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Improved debugging of failed middleware_exceptions tests.

This commit is contained in:
Carl Meyer 2016-06-17 01:28:33 -07:00
parent 9c3fbf5423
commit 702dfa3589

View File

@ -162,11 +162,24 @@ class BaseMiddlewareExceptionTest(SimpleTestCase):
self.assertEqual(value.args, (error, )) self.assertEqual(value.args, (error, ))
def assert_middleware_usage(self, middleware, request, view, template_response, response, exception): def assert_middleware_usage(self, middleware, request, view, template_response, response, exception):
self.assertEqual(middleware.process_request_called, request) # include the middleware name for easier debugging of failures
self.assertEqual(middleware.process_view_called, view) self.assertEqual(
self.assertEqual(middleware.process_template_response_called, template_response) (
self.assertEqual(middleware.process_response_called, response) middleware.__class__.__name__,
self.assertEqual(middleware.process_exception_called, exception) middleware.process_request_called,
middleware.process_view_called,
middleware.process_template_response_called,
middleware.process_response_called,
middleware.process_exception_called,
), (
middleware.__class__.__name__,
request,
view,
template_response,
response,
exception,
)
)
class MiddlewareTests(BaseMiddlewareExceptionTest): class MiddlewareTests(BaseMiddlewareExceptionTest):