web/test/unittest_application.py
changeset 10604 d4bf85db41f2
parent 10356 a009a31fb1ea
child 10605 61521bee2b68
equal deleted inserted replaced
10603:65ad6980976e 10604:d4bf85db41f2
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    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 
       
    22 from six.moves import http_client
    22 
    23 
    23 from logilab.common.testlib import TestCase, unittest_main
    24 from logilab.common.testlib import TestCase, unittest_main
    24 from logilab.common.decorators import clear_cache, classproperty
    25 from logilab.common.decorators import clear_cache, classproperty
    25 
    26 
    26 from cubicweb import AuthenticationError
    27 from cubicweb import AuthenticationError
   265         with self.temporary_appobjects(ErrorAjaxView):
   266         with self.temporary_appobjects(ErrorAjaxView):
   266             with real_error_handling(self.app) as app:
   267             with real_error_handling(self.app) as app:
   267                 with self.admin_access.web_request(vid='test.ajax.error') as req:
   268                 with self.admin_access.web_request(vid='test.ajax.error') as req:
   268                     req.ajax_request = True
   269                     req.ajax_request = True
   269                     page = app.handle_request(req, '')
   270                     page = app.handle_request(req, '')
   270         self.assertEqual(httplib.INTERNAL_SERVER_ERROR,
   271         self.assertEqual(http_client.INTERNAL_SERVER_ERROR,
   271                          req.status_out)
   272                          req.status_out)
   272 
   273 
   273     def _test_cleaned(self, kwargs, injected, cleaned):
   274     def _test_cleaned(self, kwargs, injected, cleaned):
   274         with self.admin_access.web_request(**kwargs) as req:
   275         with self.admin_access.web_request(**kwargs) as req:
   275             page = self.app_handle_request(req, 'view')
   276             page = self.app_handle_request(req, 'view')