File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,20 @@ def get_response(request):
101101 self .assertContains (response , "</div>\n </body>" )
102102
103103 def test_cache_page (self ):
104+ # Clear the cache before testing the views. Other tests that use cached_view
105+ # may run earlier and cause fewer cache calls.
106+ cache .clear ()
107+ self .client .get ("/cached_view/" )
108+ self .assertEqual (len (self .toolbar .get_panel_by_id ("CachePanel" ).calls ), 3 )
109+ self .client .get ("/cached_view/" )
110+ self .assertEqual (len (self .toolbar .get_panel_by_id ("CachePanel" ).calls ), 5 )
111+
112+ @override_settings (ROOT_URLCONF = "tests.urls_use_package_urls" )
113+ def test_include_package_urls (self ):
114+ """Test urlsconf that uses the debug_toolbar.urls in the include call"""
115+ # Clear the cache before testing the views. Other tests that use cached_view
116+ # may run earlier and cause fewer cache calls.
117+ cache .clear ()
104118 self .client .get ("/cached_view/" )
105119 self .assertEqual (len (self .toolbar .get_panel_by_id ("CachePanel" ).calls ), 3 )
106120 self .client .get ("/cached_view/" )
Original file line number Diff line number Diff line change 1+ """urls.py to test using debug_toolbar.urls in include"""
2+ from django .urls import include , path
3+
4+ import debug_toolbar
5+
6+ from . import views
7+
8+ urlpatterns = [
9+ path ("cached_view/" , views .cached_view ),
10+ path ("__debug__/" , include (debug_toolbar .urls )),
11+ ]
You can’t perform that action at this time.
0 commit comments