def coro(): yield command.ping('Are you there?') yield command.PING('Hello World!') yield command.Command('dump') yield command.run('/usr/bin/bash', args=['-c','echo $ZZ1; echo $ZZ2'], env=dict(ZZ1='Zzzz...', ZZ2='__ZZZZ__')) yield 'end' # start monitoring 'end' yield command.Command('dump') yield WAIT yield command.Command('dump') return
def testMain(self): be = backends.CmdOnlyBackend() be.set_controller( FakeController(test_case=self, expected=command.no_output())) def test(be, input, output): be.controller.expected = output be.proc_input(input) test(be, 'ping', command.ping()) test(be, 'PING a message', command.PING('a message')) test(be, 'run a_task', command.run('a_task'))
def connectionMade(self): self.linfo("I am connected!") ControllerAdaptor_Backend_JSON.connectionMade(self) self.proc_cmd(self.backend, command.PING("Hello everybody!"))
def testCommands(self): self._test_('ping', command.ping()) self._test_('ping hello world', command.ping('hello world')) self._test_('PING', command.PING()) self._test_('PING hello world', command.PING('hello world')) self._test_('kill', command.command('kill'))
def proc_cmd_PING(self, cmd, cmd_args): if cmd_args: message = ' '.join(cmd_args) else: message = None return command.PING(message)