def testGetMountPoint(self): """ Test class method getMountPoint """ rdt = RamDiskTemplate(100, "/tmp/testmnt") self.assertTrue(rdt.getMountPoint() == "/tmp/testmnt", "getMountPoint template method should have failed...")
def testGetDevice(self): """ Test class method getDevice """ rdt = RamDiskTemplate() self.assertTrue(rdt.getDevice() == rdt.myRamdiskDev, "getDevice template method should have failed")
def test_format(self): """ Test class method _format """ rdt = RamDiskTemplate() self.assertFalse(rdt._format(), "_format template method should have failed...")
def testUnmount(self): """ Test class method unmount """ rdt = RamDiskTemplate() self.assertFalse(rdt.unmount(), "Unmount template method didn't fail...")
def testGetRandomizedMountPoint(self): """ Test class method getRandomizedMountPoint - make sure the specified directory has been created. """ rdt = RamDiskTemplate(100) randomizedMntPnt = rdt.getRandomizedMountpoint() self.assertTrue(randomizedMntPnt, "Didn't succeed in getting randomized mount point...") self.assertTrue(os.path.isdir(rdt.mntPoint))
def testGetData(self): """ Test class getData method. This method also tests the other getNxxxxxData methods that provide getting functionality. """ rdt = RamDiskTemplate(100, "/tmp/tmptest") success, mntpnt, device = rdt.getData() self.assertFalse(success, "No success for getData...") self.assertTrue(mntpnt == "/tmp/tmptest", "Mountpoints don't match...") self.assertTrue(device == str(None), "Device initialized??? : " + str(device))
def testInit(self): """ Test class init functionality """ rdt = RamDiskTemplate(100, "/tmp/tmptest") self.assertTrue(rdt.diskSize == 100, "Sizes don't match...") self.assertTrue(rdt.mntPoint == "/tmp/tmptest", "Mountpoints don't match...") self.assertTrue(isinstance(rdt.logger, CyLogger), "Logger shouldn't be initialized...")