Skip to content

Commit 9dc89cc

Browse files
sertacyildiz-zzaaugustin
authored andcommitted
Toolbar insertion test for middleware
Byte counts of "İ" and "İ".lower() are different. If the page html contains "İ", process_response() method cannot insert the toolbar content at the correct index, and breaks the page content.
1 parent 80d8f70 commit 9dc89cc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/test_integration.py

+6
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ def test_middleware_view_only(self):
8080
def test_middleware_response_only(self):
8181
DebugToolbarMiddleware().process_response(self.request, self.response)
8282

83+
def test_middleware_response_insertion(self):
84+
resp = regular_view(self.request, "İ")
85+
DebugToolbarMiddleware().process_response(self.request, resp)
86+
# check toolbar insertion before "</body>"
87+
self.assertContains(resp, '</div>\n</body>')
88+
8389

8490
@override_settings(DEBUG=True)
8591
class DebugToolbarIntegrationTestCase(TestCase):

0 commit comments

Comments
 (0)