def test_coerce_device_file(self): """Test coercion of device identifiers to device files.""" assert coerce_device_file( '/dev/mapper/backups') == '/dev/mapper/backups' assert (coerce_device_file('LABEL="Linux Boot"') == r'/dev/disk/by-label/Linux\x20Boot') assert (coerce_device_file('UUID=1012dd1a-a455-40c4-914f-f3b1b2cf5b86') == '/dev/disk/by-uuid/1012dd1a-a455-40c4-914f-f3b1b2cf5b86') self.assertRaises( ValueError, coerce_device_file, 'PARTUUID=e6c021cc-d0d8-400c-8f5c-b10adeff65fe', )
def source_device(self): """ The block special device or file that contains the encrypted data (a string). The value of this property is computed by passing :attr:`source` to :func:`.coerce_device_file()`. """ return coerce_device_file(self.source)
def device_file(self): """ The block special device to be mounted (a string). The value of this property is computed by passing :attr:`device` to :func:`.coerce_device_file()`. """ return coerce_device_file(self.device)