Esempio n. 1
0
    def test_return_structure(self, patched_call):
        lsblk_stdout = [
			'/dev/dm-0 /dev/mapper/ceph--8b2684eb--56ff--49e4--8f28--522e04cbd6ab-osd--data--9fc29fbf--3b5b--4066--be10--61042569b5a7 lvm',
			'/dev/vda  /dev/vda                                                                                                       disk',
			'/dev/vda1 /dev/vda1                                                                                                      part',
			'/dev/vdb  /dev/vdb                                                                                                       disk',]
        patched_call.return_value = (lsblk_stdout, '', 0)
        disks = disk.get_block_devs_lsblk()
        assert len(disks) == len(lsblk_stdout)
        assert len(disks[0]) == 3
Esempio n. 2
0
 def test_raise_on_failure(self, patched_call):
     patched_call.return_value = ([], 'error', 1)
     with pytest.raises(OSError):
         disk.get_block_devs_lsblk()
Esempio n. 3
0
 def test_empty_lsblk(self, patched_call):
     patched_call.return_value = ([], '', 0)
     disks = disk.get_block_devs_lsblk()
     assert len(disks) == 0