From 9dc89cc9642a71bbb069d636e369131ce69d4e8e Mon Sep 17 00:00:00 2001 From: Sertaç Ö. Yıldız Date: Sun, 19 Jan 2014 03:39:27 +0200 Subject: 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. --- tests/test_integration.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/test_integration.py') diff --git a/tests/test_integration.py b/tests/test_integration.py index 56a2d9c..e7a4fe0 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -80,6 +80,12 @@ class DebugToolbarTestCase(BaseTestCase): def test_middleware_response_only(self): DebugToolbarMiddleware().process_response(self.request, self.response) + def test_middleware_response_insertion(self): + resp = regular_view(self.request, "İ") + DebugToolbarMiddleware().process_response(self.request, resp) + # check toolbar insertion before "" + self.assertContains(resp, '\n') + @override_settings(DEBUG=True) class DebugToolbarIntegrationTestCase(TestCase): -- cgit v1.2.3