aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAymeric Augustin2013-11-10 23:07:56 +0100
committerAymeric Augustin2013-11-10 23:45:45 +0100
commit9f089f061a737e7bb1620f03befe966e1c771087 (patch)
tree86b4a2f265df5fc078adc1948f3f4b57fab92b6f /tests
parent35f90e2644dcb9e49247b80535f3a4e070b8943b (diff)
downloaddjango-debug-toolbar-9f089f061a737e7bb1620f03befe966e1c771087.tar.bz2
Be resilient if not all middleware run.
Fix #129.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_integration.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_integration.py b/tests/test_integration.py
index 4bb0d38..a80f50c 100644
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -12,6 +12,7 @@ from debug_toolbar.middleware import DebugToolbarMiddleware, show_toolbar
from debug_toolbar.panels.request_vars import RequestVarsDebugPanel
from .base import BaseTestCase
+from .views import regular_view
rf = RequestFactory()
@@ -117,6 +118,15 @@ class DebugToolbarTestCase(BaseTestCase):
self.assertEqual(stats['view_kwargs'], 'None')
self.assertEqual(stats['view_func'], '<no view>')
+ # Django doesn't guarantee that process_request, process_view and
+ # process_response always get called in this order.
+
+ def test_middleware_view_only(self):
+ DebugToolbarMiddleware().process_view(self.request, regular_view, ('title',), {})
+
+ def test_middleware_response_only(self):
+ DebugToolbarMiddleware().process_response(self.request, self.response)
+
@override_settings(DEBUG=True)
class DebugToolbarIntegrationTestCase(TestCase):