1. Erik Romijn
  2. django_xhtml_validator_example

Commits

Erik Romijn  committed 642c44f

making test slightly nicer

  • Participants
  • Parent commits 18964c3
  • Branches default

Comments (0)

Files changed (1)

File example/tests.py

View file
  • Ignore whitespace
 class ExampleTestCase(TestCase):
 
     def setUp(self):
-        """Set up tests"""
+        """Set up XHTML DTD"""
         self.dtd = etree.DTD("xhtml-dtd/xhtml1-transitional.dtd")
 
     def test_foo(self):
         view = views.foo
         response = self.client.get(reverse(view))
         self.assertEquals(response.status_code, 200)
-        self.util_check_xml(response)
+        self.util_check_xhtml(response)
         
 
-    def util_check_xml(self, response_object):
+    def util_check_xhtml(self, response_object):
         """Check whether the returned XHTML is valid"""
-        if response_object['Content-Type'].startswith("text/html"):
-            root = etree.XML(response_object.content)
-            result = self.dtd.validate(root)
-            self.assertTrue(result, self.dtd.error_log.filter_from_errors())
+        root = etree.XML(response_object.content)
+        result = self.dtd.validate(root)
+        self.assertTrue(result, self.dtd.error_log.filter_from_errors())