Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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()
Beispiel #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()
Beispiel #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
Beispiel #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()
Beispiel #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()