def test_device_ok(self): utils.filesystem.mount(self.VFAT_DEVICE, self.VFAT_MOUNTPOINT) test_manager = DriveMonitor(self.VFAT_MOUNTPOINT, self.VFAT_DEVICE) time.sleep(self.SHORT_SLEEP) self.assertTrue(test_manager.is_DeviceOk(), msg="Current state: {}".format(test_manager.state)) test_manager.stop()
def test_format_full(self): utils.filesystem.mount(self.VFAT_DEVICE, self.VFAT_MOUNTPOINT) utils.filesystem.create_file( os.path.join(self.VFAT_MOUNTPOINT, "tfile"), 19.9) test_manager = DriveMonitor(self.VFAT_MOUNTPOINT, self.VFAT_DEVICE) time.sleep(self.LONG_SLEEP) self.assertTrue(test_manager.is_NotEnoughMemory(), msg="Current state: {}".format(test_manager.state)) test_manager.format_drive() time.sleep(self.SHORT_SLEEP) self.assertTrue(test_manager.is_DeviceOk(), msg="Current state: {}".format(test_manager.state)) test_manager.stop()
def test_format_exfat(self): test_manager = DriveMonitor(self.NTFS_MOUNTPOINT, self.NTFS_DEVICE) time.sleep(self.SHORT_SLEEP) self.assertTrue(test_manager.is_InvalidDevice(), msg="Current state: {}".format(test_manager.state)) test_manager.format_drive("exfat") time.sleep(self.SHORT_SLEEP) if 'fuseblk' in test_manager.SUPPORTED_FILESYSTEMS: self.assertTrue(test_manager.is_DeviceOk(), msg="Current state: {}".format(test_manager.state)) else: self.assertTrue(test_manager.is_DeviceNotCompatible(), msg="Current state: {}".format(test_manager.state)) test_manager.stop()
def test_good_cluster_size(self): utils.filesystem.create_block_device( self.VFAT_DEVICE, "vfat", additional_params=["-F", "32", "-s", "64", "-S", "512"]) self.cluster_size = 0 signal("device_warn_cluster{}".format(self.VFAT_MOUNTPOINT)).connect( self.warn_cluster) test_manager = DriveMonitor(self.VFAT_MOUNTPOINT, self.VFAT_DEVICE) time.sleep(self.SHORT_SLEEP) utils.filesystem.mount(self.VFAT_DEVICE, self.VFAT_MOUNTPOINT) time.sleep(self.SHORT_SLEEP) self.assertTrue(test_manager.is_DeviceOk(), msg="Current state: {}".format(test_manager.state)) self.assertTrue( (self.cluster_size == 0), msg="Small Cluster size should not be detected: {}".format( self.cluster_size)) signal("device_warn_cluster{}".format( self.VFAT_MOUNTPOINT)).disconnect(self.warn_cluster) test_manager.stop()