Beispiel #1
0
 def test_is_device_removable_memory_card(self):
     """
     The kernel/udev currently consider memory cards such as SD cards as non
     removable
     """
     device = "/dev/mmcblk0p1"  # Device 0, parition 1
     self.assertTrue(is_device_removable(device))
Beispiel #2
0
    def test_is_device_removable_path_doesnt_exist(self, removable_mock):
        """
        When given a non-existing path, report the device as not removable.
        """
        device = "/dev/sdb1"
        path = "/what/ever"

        removable_mock.return_value = path

        self.assertFalse(is_device_removable(device))
        removable_mock.assert_called_once_with(device)
Beispiel #3
0
    def test_is_removable_raid_device(self, is_link_mock):
        """
        When passed the path to a raid device (e.g. /dev/cciss/c0d0p0), the
        is_device_removable function returns False.
        """
        device = "/dev/cciss/c0d1p1"

        is_link_mock.return_value = False

        self.assertFalse(is_device_removable(device))
        is_link_mock.assert_called_once_with(device)
Beispiel #4
0
    def test_is_device_removable_garbage(self, removable_mock):
        """
        Given the path to a file, determine if it means the device is removable
        or not.
        """
        device = "/dev/sdb1"
        path = self.makeFile("Some garbage")

        removable_mock.return_value = path

        self.assertFalse(is_device_removable(device))
        removable_mock.assert_called_once_with(device)