def Run(self): cp = file_system.CopyFile( [constants.WINPE_TASK_LIST, constants.SYS_TASK_LIST], self._build_info) cp.Run() cp = file_system.CopyFile( [constants.WINPE_BUILD_LOG, constants.SYS_BUILD_LOG], self._build_info) cp.Run() raise RestartEvent( 'Leaving WinPE', timeout=10, task_list_path=constants.SYS_TASK_LIST)
def testCopyFile(self, build_info): src1 = r'/file1.txt' dst1 = r'/windows/glazier/glazier.log' src2 = r'/file2.txt' dst2 = r'/windows/glazier/other.log' cf = file_system.MultiCopyFile([[src1, dst1], [src2, dst2]], build_info) cf.Run() self.assertTrue(self.fs.Exists(r'/windows/glazier/glazier.log')) self.assertTrue(self.fs.Exists(r'/windows/glazier/other.log')) # bad path src1 = r'/missing.txt' cf = file_system.CopyFile([src1, dst1], build_info) self.assertRaises(file_system.ActionError, cf.Run) # bad args cf = file_system.CopyFile([src1], build_info) self.assertRaises(file_system.ActionError, cf.Run) # bad multi args cf = file_system.MultiCopyFile(src1, build_info) self.assertRaises(file_system.ActionError, cf.Run)
def testCopyFileInvalidArgs(self, build_info): cf = file_system.CopyFile([r'/file1.txt'], build_info) self.assertRaises(file_system.ActionError, cf.Run)
def testCopyFileBadPath(self, build_info): src1 = r'/missing.txt' dst1 = r'/windows/glazier/glazier.log' cf = file_system.CopyFile([src1, dst1], build_info) self.assertRaises(file_system.ActionError, cf.Run)
def testCopyFileInvalidArgs(self, build_info): with self.assertRaises(file_system.ActionError): file_system.CopyFile([r'/file1.txt'], build_info).Run()
def testCopyFileError(self, build_info, copy): src1 = r'/missing.txt' dst1 = r'/windows/glazier/glazier.log' copy.side_effect = file_util.Error('error') with self.assertRaises(file_system.ActionError): file_system.CopyFile([src1, dst1], build_info).Run()