Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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()
Ejemplo n.º 5
0
 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()
Ejemplo n.º 6
0
 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
Ejemplo n.º 7
0
 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()
Ejemplo n.º 8
0
 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()