web/test/unittest_application.py
changeset 9882 4db650d79e32
parent 9876 ff98039cb4cd
child 10080 bc7c3b0f439b
child 11062 40208f18c7c2
equal deleted inserted replaced
9881:3c2202e7bd31 9882:4db650d79e32
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    18 """unit tests for cubicweb.web.application"""
    18 """unit tests for cubicweb.web.application"""
    19 
    19 
    20 import base64, Cookie
    20 import base64, Cookie
    21 import httplib
    21 import httplib
    22 import tempfile
       
    23 
    22 
    24 from logilab.common.testlib import TestCase, unittest_main
    23 from logilab.common.testlib import TestCase, unittest_main
    25 from logilab.common.decorators import clear_cache, classproperty
    24 from logilab.common.decorators import clear_cache, classproperty
    26 
    25 
    27 from cubicweb import AuthenticationError
    26 from cubicweb import AuthenticationError
   434         with self.admin_access.web_request() as req:
   433         with self.admin_access.web_request() as req:
   435             # expect a rset with None in [0][0]
   434             # expect a rset with None in [0][0]
   436             req.form['rql'] = 'rql:Any OV1, X WHERE X custom_workflow OV1?'
   435             req.form['rql'] = 'rql:Any OV1, X WHERE X custom_workflow OV1?'
   437             self.app_handle_request(req)
   436             self.app_handle_request(req)
   438 
   437 
   439     def test_log_queries(self):
       
   440         logfile = tempfile.NamedTemporaryFile()
       
   441         self.config.global_set_option('query-log-file', logfile.name)
       
   442         with self.admin_access.web_request() as req:
       
   443             self.app.handle_request(req, 'view')
       
   444         self.assertTrue(logfile.read())
       
   445         logfile.close()
       
   446 
       
   447 
   438 
   448 if __name__ == '__main__':
   439 if __name__ == '__main__':
   449     unittest_main()
   440     unittest_main()