Example #1
0
 def testCopyDir(self, build_info):
     with Patcher() as patcher:
         patcher.fs.create_dir(r'/stage')
         patcher.fs.create_file(r'/stage/file1.txt', contents='file1')
         patcher.fs.create_file(r'/stage/file2.txt', contents='file2')
         cd = file_system.CopyDir([r'/stage', r'/root/copied'], build_info)
         cd.Validate()
         cd.Run()
         self.assertTrue(patcher.fs.exists(r'/root/copied/file1.txt'))
         self.assertTrue(patcher.fs.exists(r'/root/copied/file2.txt'))
Example #2
0
 def testCopyDirMissingArgs(self, build_info):
     cd = file_system.CopyDir([r'/stage'], build_info)
     self.assertRaises(file_system.ValidationError, cd.Validate)
     self.assertRaises(file_system.ActionError, cd.Run)
Example #3
0
 def testCopyDirException(self, build_info):
     cd = file_system.CopyDir([r'/stage', r'/stage'], build_info)
     self.assertRaises(file_system.ActionError, cd.Run)
Example #4
0
 def testCopyDirException(self, build_info):
     with Patcher() as patcher:
         patcher.fs.create_dir(r'/stage')
         with self.assertRaises(file_system.ActionError):
             file_system.CopyDir([r'/stage', r'/stage'], build_info).Run()