devtools/testlib.py
changeset 9845 9c3ec404534f
parent 9837 64c8ee99baf7
child 9929 16163ee1cdf9
equal deleted inserted replaced
9844:e7d7b7793769 9845:9c3ec404534f
   841         def raise_error_handler(*args, **kwargs):
   841         def raise_error_handler(*args, **kwargs):
   842             raise
   842             raise
   843         publisher.error_handler = raise_error_handler
   843         publisher.error_handler = raise_error_handler
   844         return publisher
   844         return publisher
   845 
   845 
       
   846     @deprecated('[3.19] use the .remote_calling method')
   846     def remote_call(self, fname, *args):
   847     def remote_call(self, fname, *args):
   847         """remote json call simulation"""
   848         """remote json call simulation"""
   848         dump = json.dumps
   849         dump = json.dumps
   849         args = [dump(arg) for arg in args]
   850         args = [dump(arg) for arg in args]
   850         req = self.request(fname=fname, pageid='123', arg=args)
   851         req = self.request(fname=fname, pageid='123', arg=args)
   851         ctrl = self.vreg['controllers'].select('ajax', req)
   852         ctrl = self.vreg['controllers'].select('ajax', req)
   852         return ctrl.publish(), req
   853         return ctrl.publish(), req
       
   854 
       
   855     @contextmanager
       
   856     def remote_calling(self, fname, *args):
       
   857         """remote json call simulation"""
       
   858         args = [json.dumps(arg) for arg in args]
       
   859         with self.admin_access.web_request(fname=fname, pageid='123', arg=args) as req:
       
   860             ctrl = self.vreg['controllers'].select('ajax', req)
       
   861             yield ctrl.publish(), req
   853 
   862 
   854     def app_handle_request(self, req, path='view'):
   863     def app_handle_request(self, req, path='view'):
   855         return self.app.core_handle(req, path)
   864         return self.app.core_handle(req, path)
   856 
   865 
   857     @deprecated("[3.15] app_handle_request is the new and better way"
   866     @deprecated("[3.15] app_handle_request is the new and better way"