def test__convert_to_device_none(self): ''' Test the device name conversor ''' salt_mock = { 'disk.blkid': MagicMock(return_value={}), } with patch.dict(mount.__salt__, salt_mock): assert mount._convert_to('/dev/sda1', 'uuid') is None salt_mock['disk.blkid'].assert_called_with('/dev/sda1')
def test__convert_to_device_none(self): """ Test the device name conversor """ salt_mock = { "disk.blkid": MagicMock(return_value={}), } with patch.dict(mount.__salt__, salt_mock): assert mount._convert_to("/dev/sda1", "uuid") is None salt_mock["disk.blkid"].assert_called_with("/dev/sda1")
def test__convert_to_token_device(self): """ Test the device name conversor """ uuid = "988c663d-74a2-432b-ba52-3eea34015f22" salt_mock = { "disk.blkid": MagicMock(return_value={"/dev/sda1": {"UUID": uuid}}), } with patch.dict(mount.__salt__, salt_mock): uuid = "UUID={}".format(uuid) assert mount._convert_to(uuid, "device") == "/dev/sda1" salt_mock["disk.blkid"].assert_called_with(token=uuid)
def test__convert_to_token_device(self): ''' Test the device name conversor ''' uuid = '988c663d-74a2-432b-ba52-3eea34015f22' salt_mock = { 'disk.blkid': MagicMock(return_value={ '/dev/sda1': {'UUID': uuid} }), } with patch.dict(mount.__salt__, salt_mock): uuid = 'UUID={}'.format(uuid) assert mount._convert_to(uuid, 'device') == '/dev/sda1' salt_mock['disk.blkid'].assert_called_with(token=uuid)
def test__convert_to_fast_token(self): """ Test the device name conversor """ assert mount._convert_to("LABEL=home", "label") == "LABEL=home"
def test__convert_to_fast_device(self): """ Test the device name conversor """ assert mount._convert_to("/dev/sda1", "device") == "/dev/sda1"
def test__convert_to_fast_token(self): ''' Test the device name conversor ''' assert mount._convert_to('LABEL=home', 'label') == 'LABEL=home'
def test__convert_to_fast_device(self): ''' Test the device name conversor ''' assert mount._convert_to('/dev/sda1', 'device') == '/dev/sda1'