def testTimeout(self): """HOD should raise Exception when rpc call times out""" # Give client some random nonexistent url serverPort = ServiceUtil.getUniqRandomPort(h='localhost',low=40000,high=50000) client = hodXRClient('http://localhost:' + str(serverPort), retryRequests=False) self.assertRaises(Exception, client.testing) pass
def testTimeout(self): """HOD should raise Exception when rpc call times out""" # Give client some random nonexistent url serverPort = ServiceUtil.getUniqRandomPort(h='localhost', low=40000, high=50000) client = hodXRClient('http://localhost:' + str(serverPort), retryRequests=False) self.assertRaises(Exception, client.testing) pass
def testInterrupt(self): """ HOD should raise HodInterruptException when interrupted""" def interrupt(testClass): testClass.assertRaises(HodInterruptException, client.testing) serverPort = ServiceUtil.getUniqRandomPort(h='localhost',low=40000,high=50000) client = hodXRClient('http://localhost:' + str(serverPort)) myThread = threading.Thread(name='testinterrupt', target=interrupt,args=(self,)) # Set the global interrupt hodInterrupt.setFlag() myThread.start() myThread.join() pass
def __init__(self): # suite setup BaseTestSuite.__init__(self, __name__, excludes) def rpcCall(): return True global serverPort serverPort = ServiceUtil.getUniqRandomPort(h='localhost',low=40000,high=50000) self.server = hodXMLRPCServer('localhost', [serverPort]) self.server.register_function(rpcCall, 'testing') self.thread = threading.Thread(name="server", target=self.server._serve_forever) self.thread.start() time.sleep(1) # give some time to start server
def __init__(self): # suite setup BaseTestSuite.__init__(self, __name__, excludes) def rpcCall(): return True global serverPort serverPort = ServiceUtil.getUniqRandomPort(h='localhost', low=40000, high=50000) self.server = hodXMLRPCServer('localhost', [serverPort]) self.server.register_function(rpcCall, 'testing') self.thread = threading.Thread(name="server", target=self.server._serve_forever) self.thread.start() time.sleep(1) # give some time to start server
def testInterrupt(self): """ HOD should raise HodInterruptException when interrupted""" def interrupt(testClass): testClass.assertRaises(HodInterruptException, client.testing) serverPort = ServiceUtil.getUniqRandomPort(h='localhost', low=40000, high=50000) client = hodXRClient('http://localhost:' + str(serverPort)) myThread = threading.Thread(name='testinterrupt', target=interrupt, args=(self, )) # Set the global interrupt hodInterrupt.setFlag() myThread.start() myThread.join() pass