@mock.patch('os.rmdir')
    @mock.patch('shutil.copytree')
    @mock.patch('cloudbaseinit.metadata.services.osconfigdrive.windows.'
                'WindowsConfigDriveManager.'
                '_check_for_config_drive')
    def _test_get_config_drive_from_volume(self, mock_check_for_config_drive,
                                           mock_copytree, mock_os_rmdir,
                                           found=True):
        volumes = [mock.Mock() for _ in range(3)]
        self.osutils.get_volumes.return_value = volumes
        checks = [False, found, found]
        mock_check_for_config_drive.side_effect = checks
        idx = 3 - int(found)
        check_calls = [mock.call(volume) for volume in volumes[:idx]]

        response = self._config_manager._get_config_drive_from_volume()
        self.osutils.get_volumes.assert_called_once_with()
        mock_check_for_config_drive.assert_has_calls(check_calls)
        if found:
            mock_os_rmdir.assert_called_once_with(
                self._config_manager.target_path)
            mock_copytree.assert_called_once_with(
                volumes[1], self._config_manager.target_path)
        self.assertEqual(found, response)
dataset/ETHPy150Open openstack/cloudbase-init/cloudbaseinit/tests/metadata/services/osconfigdrive/test_windows.py/TestWindowsConfigDriveManager._test_get_config_drive_from_volume/original