1
1
from debug_toolbar .middleware import DebugToolbarMiddleware
2
2
from debug_toolbar .panels .sql import SQLDebugPanel
3
+ from debug_toolbar .panels .request_vars import RequestVarsDebugPanel
3
4
from debug_toolbar .toolbar .loader import DebugToolbar
4
5
from debug_toolbar .utils .tracking import pre_dispatch , post_dispatch , callbacks
5
6
@@ -133,6 +134,28 @@ def test_request_urlconf_module(self):
133
134
self .assertEquals (request .urlconf .urlpatterns [0 ]._callback_str , 'debug_toolbar.views.debug_media' )
134
135
self .assertEquals (request .urlconf .urlpatterns [- 1 ].urlconf_name .__name__ , 'tests.urls' )
135
136
137
+ def test_with_process_view (self ):
138
+ request = self .request
139
+
140
+ def _test_view (request ):
141
+ return HttpResponse ('' )
142
+
143
+ with Settings (DEBUG = True ):
144
+ panel = self .toolbar .get_panel (RequestVarsDebugPanel )
145
+ panel .process_request (request )
146
+ panel .process_view (request , _test_view , [], {})
147
+ content = panel .content ()
148
+ self .assertIn ('debug_toolbar.tests.tests._test_view' , content )
149
+
150
+ def test_without_process_view (self ):
151
+ request = self .request
152
+
153
+ with Settings (DEBUG = True ):
154
+ panel = self .toolbar .get_panel (RequestVarsDebugPanel )
155
+ panel .process_request (request )
156
+ content = panel .content ()
157
+ self .assertIn ('<no view>' , content )
158
+
136
159
class SQLPanelTestCase (BaseTestCase ):
137
160
def test_recording (self ):
138
161
panel = self .toolbar .get_panel (SQLDebugPanel )
@@ -281,4 +304,4 @@ def test(**kwargs):
281
304
self .assertTrue ('kwargs' in foo , foo )
282
305
self .assertTrue (len (foo ['kwargs' ]), 1 )
283
306
self .assertTrue ('foo' in foo ['kwargs' ])
284
- self .assertEquals (foo ['kwargs' ]['foo' ], 'bar' )
307
+ self .assertEquals (foo ['kwargs' ]['foo' ], 'bar' )
0 commit comments