def test_execute_raise(self): self.popen=patch('freezer.utils.exec_cmd.subprocess.Popen') self.mock_popen=self.popen.start() self.mock_popen.return_value.returncode = 1 backup_opt = BackupOpt1() backup_opt.command = 'echo test' job = jobs.ExecJob(backup_opt, backup_opt.storage) self.assertRaises(Exception, job.execute)
def test_execute_nothing_to_do(self): self.mock_popen.return_value.returncode = 0 backup_opt = BackupOpt1() backup_opt.command = 'ls ' jobs.ExecJob(backup_opt, backup_opt.storage).execute()
def test_execute_script(self): self.mock_popen.return_value.returncode = 0 backup_opt = BackupOpt1() backup_opt.command='echo test' jobs.ExecJob(backup_opt, backup_opt.storage).execute()
def test_execute_nothing_to_do(self): backup_opt = BackupOpt1() jobs.ExecJob(backup_opt, backup_opt.storage).execute()