def test_command_execution(self, Popen): Popen.return_value = DummyProcess() command = CommandExecutor(["ls", "/"]) status = command.execute() self.assertEquals(status.output, "stdout") self.assertEquals(status.error, "stderr") self.assertEquals(status.returncode, 0)
def test_command_execution(self, Popen): Popen.return_value = DummyProcess() command = CommandExecutor(["ls", "/"]) status = command.execute() self.assertEquals(status.output, "stdout") self.assertEquals(status.error, "stderr") self.assertEquals(status.returncode, 0)
def backup(self): """ Executes mysqldump and performs backup. The backup is stored in the destination file. :return: """ with open(self.destination, 'w') as dump_file: command = ["mysqldump", "-u", self.username, "-p" + self.password, self.database] executor = CommandExecutor(command, stdout=dump_file) executor.execute()
def backup(self): """ Executes mysqldump and performs backup. The backup is stored in the destination file. :return: """ with open(self.destination, 'w') as dump_file: command = [ "mysqldump", "-u", self.username, "--password={0}".format(self.password), "-h", self.host, self.database ] executor = CommandExecutor(command, stdout=dump_file) executor.execute()