equal
deleted
inserted
replaced
1 """cubicweb.web.views.basecontrollers unit tests""" |
1 """cubicweb.web.views.basecontrollers unit tests""" |
2 import simplejson |
2 import simplejson |
3 |
3 |
4 from logilab.common.testlib import unittest_main |
4 from logilab.common.testlib import unittest_main, mock_object |
5 |
5 |
6 from cubicweb import Binary, Unauthorized |
6 from cubicweb import Binary, Unauthorized |
7 from cubicweb.devtools._apptest import TestEnvironment |
7 from cubicweb.devtools._apptest import TestEnvironment |
8 from cubicweb.devtools.apptest import EnvBasedTC, ControllerTC |
8 from cubicweb.devtools.apptest import EnvBasedTC, ControllerTC |
9 |
9 |
531 pageid='123', fname='view') |
531 pageid='123', fname='view') |
532 ctrl = self.ctrl(req) |
532 ctrl = self.ctrl(req) |
533 rset = self.john.as_rset() |
533 rset = self.john.as_rset() |
534 rset.req = req |
534 rset.req = req |
535 self.assertTextEquals(ctrl.publish(), |
535 self.assertTextEquals(ctrl.publish(), |
536 xhtml_wrap(ctrl.view('primary', rset))) |
536 xhtml_wrap(mock_object(req=req), ctrl.view('primary', rset))) |
537 |
537 |
538 # def test_json_exec(self): |
538 # def test_json_exec(self): |
539 # rql = 'Any T,N WHERE T is Tag, T name N' |
539 # rql = 'Any T,N WHERE T is Tag, T name N' |
540 # ctrl = self.ctrl(self.request(mode='json', rql=rql, pageid='123')) |
540 # ctrl = self.ctrl(self.request(mode='json', rql=rql, pageid='123')) |
541 # self.assertEquals(ctrl.publish(), |
541 # self.assertEquals(ctrl.publish(), |