aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tests.py')
-rw-r--r--tests/tests.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/tests.py b/tests/tests.py
index 31b96c8..84b4418 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -1,5 +1,6 @@
from debug_toolbar.middleware import DebugToolbarMiddleware
from debug_toolbar.panels.sql import SQLDebugPanel
+from debug_toolbar.panels.request_vars import RequestVarsDebugPanel
from debug_toolbar.toolbar.loader import DebugToolbar
from debug_toolbar.utils.tracking import pre_dispatch, post_dispatch, callbacks
@@ -133,6 +134,28 @@ class DebugToolbarTestCase(BaseTestCase):
self.assertEquals(request.urlconf.urlpatterns[0]._callback_str, 'debug_toolbar.views.debug_media')
self.assertEquals(request.urlconf.urlpatterns[-1].urlconf_name.__name__, 'tests.urls')
+ def test_with_process_view(self):
+ request = self.request
+
+ def _test_view(request):
+ return HttpResponse('')
+
+ with Settings(DEBUG=True):
+ panel = self.toolbar.get_panel(RequestVarsDebugPanel)
+ panel.process_request(request)
+ panel.process_view(request, _test_view, [], {})
+ content = panel.content()
+ self.assertIn('debug_toolbar.tests.tests._test_view', content)
+
+ def test_without_process_view(self):
+ request = self.request
+
+ with Settings(DEBUG=True):
+ panel = self.toolbar.get_panel(RequestVarsDebugPanel)
+ panel.process_request(request)
+ content = panel.content()
+ self.assertIn('<no view>', content)
+
class SQLPanelTestCase(BaseTestCase):
def test_recording(self):
panel = self.toolbar.get_panel(SQLDebugPanel)
@@ -281,4 +304,4 @@ class TrackingTestCase(BaseTestCase):
self.assertTrue('kwargs' in foo, foo)
self.assertTrue(len(foo['kwargs']), 1)
self.assertTrue('foo' in foo['kwargs'])
- self.assertEquals(foo['kwargs']['foo'], 'bar') \ No newline at end of file
+ self.assertEquals(foo['kwargs']['foo'], 'bar')