def proxyMethodHandler(self, kw): """Dummy proxyMethodHandler""" # login as super user newSecurityManager(self, self.getPortalObject().acl_users.getUserById(ERP5Security.SUPER_USER)) data = getattr(self, kw["method_id"])(**kw["method_kw"]) response = GeneratorCall(data=data) return response.dump()
def proxyMethodHandler(self, kw): """Dummy proxyMethodHandler""" # login as super user newSecurityManager( self, self.getPortalObject().acl_users.getUserById(SUPER_USER)) data = getattr(self, kw['method_id'])(**kw['method_kw']) response = GeneratorCall(data=data) return response.dump()
def test_dump_load(self): call = GeneratorCall(data='Foo') self.assertEqual(call['data'], 'Foo') dumped = call.dump() self.assertTrue(isinstance(dumped, str)) # reread it in a new call read = GeneratorCall() read.load(dumped) self.assertEqual(read['data'], 'Foo')
def test_dump(self): call = GeneratorCall() dumped = call.dump() self.assertTrue(isinstance(dumped, str)) load = xmlrpclib.loads(dumped) self.assertTrue(isinstance(load, tuple)) self.assertEqual(len(load), 2) self.assertEqual(load[1], 'GeneratorAnswer') self.assertTrue(isinstance(load[0], tuple)) self.assertEqual(len(load[0]), 1) server_response_dict = load[0][0] self.assertTrue(isinstance(server_response_dict, dict))