web/test/unittest_views_basecontrollers.py
changeset 8941 7b26fe71404f
parent 8849 7da8339cd768
child 9020 cb87e831c183
child 9179 570208f74a84
equal deleted inserted replaced
8940:ae898a084da2 8941:7b26fe71404f
   564                            pageid='123', fname='view')
   564                            pageid='123', fname='view')
   565         ctrl = self.ctrl(req)
   565         ctrl = self.ctrl(req)
   566         rset = self.john.as_rset()
   566         rset = self.john.as_rset()
   567         rset.req = req
   567         rset.req = req
   568         source = ctrl.publish()
   568         source = ctrl.publish()
   569         self.assertTrue(source.startswith('<?xml version="1.0"?>\n' + STRICT_DOCTYPE +
       
   570                                           u'<div xmlns="http://www.w3.org/1999/xhtml" xmlns:cubicweb="http://www.logilab.org/2008/cubicweb">')
       
   571                         )
       
   572         req.xhtml_browser = lambda: False
       
   573         source = ctrl.publish()
       
   574         self.assertTrue(source.startswith('<div>'))
   569         self.assertTrue(source.startswith('<div>'))
   575 
   570 
   576 #     def test_json_exec(self):
   571 #     def test_json_exec(self):
   577 #         rql = 'Any T,N WHERE T is Tag, T name N'
   572 #         rql = 'Any T,N WHERE T is Tag, T name N'
   578 #         ctrl = self.ctrl(self.request(mode='json', rql=rql, pageid='123'))
   573 #         ctrl = self.ctrl(self.request(mode='json', rql=rql, pageid='123'))
   742         @monkeypatch(JSonController)
   737         @monkeypatch(JSonController)
   743         @xhtmlize
   738         @xhtmlize
   744         def js_foo(self):
   739         def js_foo(self):
   745             return u'hello'
   740             return u'hello'
   746         res, req = self.remote_call('foo')
   741         res, req = self.remote_call('foo')
   747         self.assertEqual(res,
   742         self.assertEqual(u'<div>hello</div>', res)
   748                          '<?xml version="1.0"?>\n' + STRICT_DOCTYPE +
       
   749                          u'<div xmlns="http://www.w3.org/1999/xhtml" xmlns:cubicweb="http://www.logilab.org/2008/cubicweb">hello</div>')
       
   750 
   743 
   751     def test_monkeypatch_jsoncontroller_jsonize(self):
   744     def test_monkeypatch_jsoncontroller_jsonize(self):
   752         self.assertRaises(RemoteCallFailed, self.remote_call, 'foo')
   745         self.assertRaises(RemoteCallFailed, self.remote_call, 'foo')
   753         @monkeypatch(JSonController)
   746         @monkeypatch(JSonController)
   754         @jsonize
   747         @jsonize