コード例 #1
0
def sqlmanager(tmp_path, downloader, sqlstorage, mocker):
    sqlmanager = DataManager(Cache(downloader, sqlstorage, tmp_path))
    sqlmanager._tempdir = str(tmp_path)
    m = mock.Mock()
    m.headers = {'Content-Disposition': 'test_file'}
    mocker.patch('sunpy.data.data_manager.cache.urlopen', return_value=m)
    yield sqlmanager
コード例 #2
0
def module_patched_manager(tmp_path, downloader, storage, mocker):
    def _get_module(func):
        return 'fake_module.'

    module_patched_manager = DataManager(Cache(downloader, storage, tmp_path))
    module_patched_manager._tempdir = str(tmp_path)
    module_patched_manager._get_module = _get_module
    m = mock.Mock()
    m.headers = {'Content-Disposition': 'test_file'}
    mocker.patch('sunpy.data.data_manager.cache.urlopen', return_value=m)
    yield module_patched_manager