def testSendCommandWithParams(self): p = PythonScriptLauncher() params = {'toreplace' : 'REPLACED' } p.sendCommand(self.tmpfile3, 4,params) out = p.readOutput() print out self.assertIn("REPLACED", out)
def testRunFailTimeOut(self): p = PythonScriptLauncher() p.sendCommand(self.tmpfile, 0.1) self.assertFalse(p.globalVariables.has_key('a')) self.assertEqual(p.localVariables['a'],1) self.assertFalse(p.localVariables.has_key('b')) out = p.readOutput() self.assertEqual(out,None)
def testInputOutputParams(self): p = PythonScriptLauncher() params = {'param1' : 1234, 'param2' : 5678 } p.setInputParameters(params) p.sendCommand(self.tmpfile2, 4) out = p.readOutput() print out self.assertIn("{'param2': 5678, 'param1': 1234}", out) res = p.getResult() self.assertEqual(res,{'out' : 1234})
def testRunSuccess(self): p = PythonScriptLauncher() p.sendCommand(self.tmpfile, 4) self.assertFalse(p.globalVariables.has_key('a')) self.assertEqual(p.localVariables['a'],1) self.assertEqual(p.localVariables['b'],2) out = p.readOutput() self.assertEqual(out,'Starting...\nFinishing...\n')