web/test/unittest_views_baseviews.py
branchstable
changeset 9523 cd5738fc440f
parent 9137 c791d8fddc15
child 9838 14640aeb5ddc
equal deleted inserted replaced
9522:8154a5748194 9523:cd5738fc440f
   131 
   131 
   132         with self.temporary_appobjects(MyView):
   132         with self.temporary_appobjects(MyView):
   133             html_source = self.view('my-view').source
   133             html_source = self.view('my-view').source
   134             source_lines = [line.strip() for line in html_source.splitlines(False)
   134             source_lines = [line.strip() for line in html_source.splitlines(False)
   135                             if line.strip()]
   135                             if line.strip()]
   136             self.assertListEqual(['<!DOCTYPE html>', '<html lang="en">'], source_lines[:2])
   136             self.assertListEqual(['<!DOCTYPE html>', '<html xmlns:cubicweb="http://www.cubicweb.org" lang="en">'], source_lines[:2])
   137 
   137 
   138     def test_set_doctype_no_reset_xmldecl(self):
   138     def test_set_doctype_no_reset_xmldecl(self):
   139         """
   139         """
   140         tests `cubicweb.web.request.CubicWebRequestBase.set_doctype`
   140         tests `cubicweb.web.request.CubicWebRequestBase.set_doctype`
   141         with no xmldecl reset
   141         with no xmldecl reset
   149 
   149 
   150         with self.temporary_appobjects(MyView):
   150         with self.temporary_appobjects(MyView):
   151             html_source = self.view('my-view').source
   151             html_source = self.view('my-view').source
   152             source_lines = [line.strip() for line in html_source.splitlines(False)
   152             source_lines = [line.strip() for line in html_source.splitlines(False)
   153                             if line.strip()]
   153                             if line.strip()]
   154             self.assertListEqual([html_doctype, '<html lang="cz">', '<head>'],
   154             self.assertListEqual([html_doctype, '<html xmlns:cubicweb="http://www.cubicweb.org" lang="cz">', '<head>'],
   155                                  source_lines[:3])
   155                                  source_lines[:3])
   156 
   156 
   157 if __name__ == '__main__':
   157 if __name__ == '__main__':
   158     unittest_main()
   158     unittest_main()