@@ -109,28 +109,28 @@ def test_cache_page(self):
109
109
# Clear the cache before testing the views. Other tests that use cached_view
110
110
# may run earlier and cause fewer cache calls.
111
111
cache .clear ()
112
- self .client .get ("/cached_view/" )
113
- self .assertEqual (len (self .toolbar .get_panel_by_id ("CachePanel" ).calls ), 3 )
114
- self .client .get ("/cached_view/" )
115
- self .assertEqual (len (self .toolbar .get_panel_by_id ("CachePanel" ).calls ), 5 )
112
+ response = self .client .get ("/cached_view/" )
113
+ self .assertEqual (len (response .toolbar .get_panel_by_id ("CachePanel" ).calls ), 3 )
114
+ response = self .client .get ("/cached_view/" )
115
+ self .assertEqual (len (response .toolbar .get_panel_by_id ("CachePanel" ).calls ), 2 )
116
116
117
117
@override_settings (ROOT_URLCONF = "tests.urls_use_package_urls" )
118
118
def test_include_package_urls (self ):
119
119
"""Test urlsconf that uses the debug_toolbar.urls in the include call"""
120
120
# Clear the cache before testing the views. Other tests that use cached_view
121
121
# may run earlier and cause fewer cache calls.
122
122
cache .clear ()
123
- self .client .get ("/cached_view/" )
124
- self .assertEqual (len (self .toolbar .get_panel_by_id ("CachePanel" ).calls ), 3 )
125
- self .client .get ("/cached_view/" )
126
- self .assertEqual (len (self .toolbar .get_panel_by_id ("CachePanel" ).calls ), 5 )
123
+ response = self .client .get ("/cached_view/" )
124
+ self .assertEqual (len (response .toolbar .get_panel_by_id ("CachePanel" ).calls ), 3 )
125
+ response = self .client .get ("/cached_view/" )
126
+ self .assertEqual (len (response .toolbar .get_panel_by_id ("CachePanel" ).calls ), 2 )
127
127
128
128
def test_low_level_cache_view (self ):
129
129
"""Test cases when low level caching API is used within a request."""
130
- self .client .get ("/cached_low_level_view/" )
131
- self .assertEqual (len (self .toolbar .get_panel_by_id ("CachePanel" ).calls ), 2 )
132
- self .client .get ("/cached_low_level_view/" )
133
- self .assertEqual (len (self .toolbar .get_panel_by_id ("CachePanel" ).calls ), 3 )
130
+ response = self .client .get ("/cached_low_level_view/" )
131
+ self .assertEqual (len (response .toolbar .get_panel_by_id ("CachePanel" ).calls ), 2 )
132
+ response = self .client .get ("/cached_low_level_view/" )
133
+ self .assertEqual (len (response .toolbar .get_panel_by_id ("CachePanel" ).calls ), 1 )
134
134
135
135
def test_cache_disable_instrumentation (self ):
136
136
"""
@@ -139,10 +139,10 @@ def test_cache_disable_instrumentation(self):
139
139
"""
140
140
self .assertIsNone (cache .set ("UseCacheAfterToolbar.before" , None ))
141
141
self .assertIsNone (cache .set ("UseCacheAfterToolbar.after" , None ))
142
- self .client .get ("/execute_sql/" )
142
+ response = self .client .get ("/execute_sql/" )
143
143
self .assertEqual (cache .get ("UseCacheAfterToolbar.before" ), 1 )
144
144
self .assertEqual (cache .get ("UseCacheAfterToolbar.after" ), 1 )
145
- self .assertEqual (len (self .toolbar .get_panel_by_id ("CachePanel" ).calls ), 0 )
145
+ self .assertEqual (len (response .toolbar .get_panel_by_id ("CachePanel" ).calls ), 0 )
146
146
147
147
def test_is_toolbar_request (self ):
148
148
self .request .path = "/__debug__/render_panel/"
0 commit comments