Example #1
0
 def test_format_read_only_fs(self):
     os.chmod(self.VFAT_RO_DEVICE, 0o444)
     test_manager = DriveMonitor(self.VFAT_RO_MOUNTPOINT,
                                 self.VFAT_RO_DEVICE)
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_InvalidDevice(),
                     msg="Current state: {}".format(test_manager.state))
     time.sleep(self.SHORT_SLEEP)
     test_manager.format_drive()
     time.sleep(self.LONG_SLEEP)
     self.assertTrue(test_manager.is_DeviceReadOnly(),
                     msg="Current state: {}".format(test_manager.state))
     utils.filesystem.unmount(self.VFAT_RO_MOUNTPOINT)
     os.remove(self.VFAT_RO_DEVICE)
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_NoDeviceDetected(),
                     msg="Current state: {}".format(test_manager.state))
     test_manager.stop()
Example #2
0
 def test_nodevice(self):
     test_manager = DriveMonitor("/tmp/tmountpoint", "/tmp/nodev")
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_NoDeviceDetected())
     test_manager.stop()
Example #3
0
 def test_format_nodev(self):
     test_manager = DriveMonitor("/tmp/tmountpoint", "/tmp/nodev")
     self.assertTrue(test_manager.is_NoDeviceDetected())
     self.assertRaises(IOError, test_manager.format_drive,
                       SETTINGS.sdcard_filesystem)
     test_manager.stop()