Revision 9c2b3a70 test/ganeti.utils.io_unittest.py

b/test/ganeti.utils.io_unittest.py
508 508
    self.assert_(os.path.isdir(os.path.join(self.tmpdir, "test")))
509 509
    self.assert_(os.path.isfile(os.path.join(self.tmpdir, "test/xyz")))
510 510

  
511
    utils.RenameFile(os.path.join(self.tmpdir, "test/xyz"),
512
                     os.path.join(self.tmpdir, "test/foo/bar/baz"),
513
                     mkdir=True)
514
    self.assert_(os.path.isdir(os.path.join(self.tmpdir, "test")))
515
    self.assert_(os.path.isdir(os.path.join(self.tmpdir, "test/foo/bar")))
516
    self.assert_(os.path.isfile(os.path.join(self.tmpdir, "test/foo/bar/baz")))
511
    self.assertRaises(EnvironmentError, utils.RenameFile,
512
                      os.path.join(self.tmpdir, "test/xyz"),
513
                      os.path.join(self.tmpdir, "test/foo/bar/baz"),
514
                      mkdir=True)
515

  
516
    self.assertTrue(os.path.exists(os.path.join(self.tmpdir, "test/xyz")))
517
    self.assertFalse(os.path.exists(os.path.join(self.tmpdir, "test/foo/bar")))
518
    self.assertFalse(os.path.exists(os.path.join(self.tmpdir, "test/foo/bar/baz")))
517 519

  
518 520

  
519 521
class TestMakedirs(unittest.TestCase):

Also available in: Unified diff