aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tests.py
diff options
context:
space:
mode:
authorAymeric Augustin2013-10-18 17:01:52 +0200
committerAymeric Augustin2013-10-18 17:01:52 +0200
commit186fcb318a87e6e89add597b8dc2d8443a765bc8 (patch)
tree242147f92f340c63ac62913a3c0a03d5c31646b7 /tests/tests.py
parentc2c3ccf8987ff4809b770c5329801496d770f27d (diff)
downloaddjango-debug-toolbar-186fcb318a87e6e89add597b8dc2d8443a765bc8.tar.bz2
Ensure the toolbar only outputs valid XML.
This allows using it in websites served with the application/xml+xhtml mime type. Fix #221.
Diffstat (limited to 'tests/tests.py')
-rw-r--r--tests/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/tests.py b/tests/tests.py
index 1188ee0..9194325 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
import logging
import threading
+from xml.etree import ElementTree as ET
import django
from django.conf import settings
@@ -191,6 +192,12 @@ class DebugToolbarIntegrationTestCase(TestCase):
if not six.PY3:
self.assertContains(response, 'là')
+ def test_xml_validation(self):
+ response = self.client.get('/regular/XML/')
+ with open('/tmp/blah.html', 'wb') as f:
+ f.write(response.content)
+ ET.fromstring(response.content) # shouldn't raise ParseError
+
class DebugToolbarNameFromObjectTest(BaseTestCase):