Revision 3b721842 test/py/ganeti.backend_unittest.py

b/test/py/ganeti.backend_unittest.py
517 517
      self.assertEqual(os.stat(self.filename).st_mode & 0777, 0644)
518 518

  
519 519

  
520
class TestGetBlockDevSymlinkPath(unittest.TestCase):
521
  def setUp(self):
522
    self.tmpdir = tempfile.mkdtemp()
523

  
524
  def tearDown(self):
525
    shutil.rmtree(self.tmpdir)
526

  
527
  def _Test(self, name, idx):
528
    self.assertEqual(backend._GetBlockDevSymlinkPath(name, idx,
529
                                                     _dir=self.tmpdir),
530
                     ("%s/%s%s%s" % (self.tmpdir, name,
531
                                     constants.DISK_SEPARATOR, idx)))
532

  
533
  def test(self):
534
    for idx in range(100):
535
      self._Test("inst1.example.com", idx)
536

  
537

  
520 538
if __name__ == "__main__":
521 539
  testutils.GanetiTestProgram()

Also available in: Unified diff