def test_find_rootfs_substring(self, mock_gfs, filesystems, root_device, expected): mock_gfs.inspect_os.return_value = [] mock_gfs.list_filesystems.return_value = filesystems res = guestfs_tools.find_rootfs(mock_gfs, root_device) mock_gfs.list_filesystems.assert_called() assert res == expected
def test_find_rootfs_substring( self, mock_gfs, filesystems, root_device, expected ): mock_gfs.inspect_os.return_value = [] mock_gfs.list_filesystems.return_value = filesystems res = guestfs_tools.find_rootfs(mock_gfs, root_device) mock_gfs.list_filesystems.assert_called() assert res == expected
def test_find_rootfs_fullname(self, mock_gfs, filesystems, root_device): mock_gfs.inspect_os.return_value = [] mock_gfs.list_filesystems.return_value = filesystems res = guestfs_tools.find_rootfs(mock_gfs, root_device) mock_gfs.list_filesystems.assert_called() assert res == root_device
def test_find_rootfs_raises(self, mock_gfs, filesystems, root_device): mock_gfs.inspect_os.return_value = [] mock_gfs.list_filesystems.return_value = filesystems with pytest.raises(GuestFSError): guestfs_tools.find_rootfs(mock_gfs, root_device) mock_gfs.list_filesystems.assert_called()
def test_find_rootfs_empty(self, mock_gfs): mock_gfs.inspect_os.return_value = [] mock_gfs.list_filesystems.return_value = {} with pytest.raises(GuestFSError): guestfs_tools.find_rootfs(mock_gfs, '/dev/sda') mock_gfs.list_filesystems.assert_called()