Пример #1
0
    def GetRemovableDeviceDescription(self, device):
        """Returns a informational description of the removable |device|.

    Args:
      device: the device name (e.g. sdc).

    Returns:
      A string describing |device| (e.g. Patriot Memory 7918 MB).
    """
        desc = [
            osutils.GetDeviceInfo(device, keyword='manufacturer'),
            osutils.GetDeviceInfo(device, keyword='product'),
            osutils.GetDeviceSize(self.DeviceNameToPath(device)),
            '(%s)' % self.DeviceNameToPath(device),
        ]
        return ' '.join([x for x in desc if x])
Пример #2
0
 def testGetDeviceSize(self):
   """Tests that we can get the size of a device."""
   self.rc.AddCmdResult(partial_mock.Ignore(), output=self.PARTIAL_OUTPUT)
   self.assertEqual(osutils.GetDeviceSize('/dev/sdc'), '7.4G')