예제 #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
예제 #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
예제 #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
예제 #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()
예제 #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()
예제 #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
예제 #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()
예제 #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()