Exemplo n.º 1
0
 def testMkdirValidate(self):
     md = file_system.MkDir('String', None)
     self.assertRaises(file_system.ValidationError, md.Validate)
     md = file_system.MkDir(['/tmp/some/dir', '/tmp/some/other/dir'], None)
     self.assertRaises(file_system.ValidationError, md.Validate)
     md = file_system.MkDir([1], None)
     self.assertRaises(file_system.ValidationError, md.Validate)
     md = file_system.MkDir(['/tmp/some/dir'], None)
     md.Validate()
Exemplo n.º 2
0
 def testMkdirValidate(self):
     with self.assertRaises(file_system.ValidationError):
         file_system.MkDir('String', None).Validate()
     with self.assertRaises(file_system.ValidationError):
         file_system.MkDir(['/tmp/some/dir', '/tmp/some/other/dir'],
                           None).Validate()
     with self.assertRaises(file_system.ValidationError):
         file_system.MkDir([1], None).Validate()
     file_system.MkDir(['/tmp/some/dir'], None).Validate()
Exemplo n.º 3
0
 def testMkdir(self, build_info):
     md = file_system.MkDir(['/stage/subdir1/subdir2'], build_info)
     md.Run()
     self.assertTrue(file_system.os.path.exists('/stage/subdir1/subdir2'))
     # bad path
     md = file_system.MkDir([r'/stage/file1.txt'], build_info)
     self.assertRaises(file_system.ActionError, md.Run)
     # bad args
     md = file_system.MkDir([], build_info)
     self.assertRaises(file_system.ActionError, md.Run)
Exemplo n.º 4
0
 def testMkdir(self, build_info, create):
     file_system.MkDir(['/stage/subdir1/subdir2'], build_info).Run()
     create.assert_called_with('/stage/subdir1/subdir2')
     # bad path
     create.side_effect = file_util.Error('error')
     with self.assertRaises(file_system.ActionError):
         file_system.MkDir([r'/stage/file1.txt'], build_info).Run()
     # bad args
     with self.assertRaises(file_system.ActionError):
         file_system.MkDir([], build_info).Run()