def testGetRemoteMethod(self): """Test valid remote method detection.""" class Service(object): @remote.method(Request, Response) def remote_method(self, request): pass self.assertEquals(Service.remote_method.remote, remote.get_remote_method_info(Service.remote_method)) self.assertTrue(Service.remote_method.remote, remote.get_remote_method_info(Service().remote_method))
def testGetNotRemoteMethod(self): """Test positive result on a remote method.""" class NotService(object): def not_remote_method(self, request): pass def fn(self): pass class NotReallyRemote(object): """Test negative result on many bad values for remote methods.""" def not_really(self, request): pass not_really.remote = 'something else' for not_remote in [NotService.not_remote_method, NotService().not_remote_method, NotReallyRemote.not_really, NotReallyRemote().not_really, None, 1, 'a string', fn]: self.assertEquals(None, remote.get_remote_method_info(not_remote))