File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 16
16
import debug_toolbar .panels .sql .tracking as sql_tracking
17
17
from debug_toolbar import settings as dt_settings
18
18
19
- from ..base import BaseTestCase
19
+ from ..base import BaseMultiDBTestCase , BaseTestCase
20
20
from ..models import PostgresJSON
21
21
22
22
@@ -506,3 +506,24 @@ def test_nested_template_information(self):
506
506
self .assertEqual (template_name , "included.html" )
507
507
self .assertEqual (template_info ["context" ][0 ]["content" ].strip (), "{{ users }}" )
508
508
self .assertEqual (template_info ["context" ][0 ]["highlight" ], True )
509
+
510
+
511
+ class SQLPanelMultiDBTestCase (BaseMultiDBTestCase ):
512
+ panel_id = "SQLPanel"
513
+
514
+ def test_aliases (self ):
515
+ self .assertFalse (self .panel ._queries )
516
+
517
+ list (User .objects .all ())
518
+ list (User .objects .using ("replica" ).all ())
519
+
520
+ response = self .panel .process_request (self .request )
521
+ self .panel .generate_stats (self .request , response )
522
+
523
+ self .assertTrue (self .panel ._queries )
524
+
525
+ query = self .panel ._queries [0 ]
526
+ self .assertEqual (query [0 ], "default" )
527
+
528
+ query = self .panel ._queries [- 1 ]
529
+ self .assertEqual (query [0 ], "replica" )
You can’t perform that action at this time.
0 commit comments