From 702dfa3589cddf996c18aee46286a49844efd70d Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Fri, 17 Jun 2016 01:28:33 -0700 Subject: [PATCH] Improved debugging of failed middleware_exceptions tests. --- tests/middleware_exceptions/tests.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/middleware_exceptions/tests.py b/tests/middleware_exceptions/tests.py index 58ac5b965f2..22925a8500e 100644 --- a/tests/middleware_exceptions/tests.py +++ b/tests/middleware_exceptions/tests.py @@ -162,11 +162,24 @@ class BaseMiddlewareExceptionTest(SimpleTestCase): self.assertEqual(value.args, (error, )) def assert_middleware_usage(self, middleware, request, view, template_response, response, exception): - self.assertEqual(middleware.process_request_called, request) - self.assertEqual(middleware.process_view_called, view) - self.assertEqual(middleware.process_template_response_called, template_response) - self.assertEqual(middleware.process_response_called, response) - self.assertEqual(middleware.process_exception_called, exception) + # include the middleware name for easier debugging of failures + self.assertEqual( + ( + middleware.__class__.__name__, + 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):