コード例 #1
0
def test_retrieve_remote_downloaded_file_download_directory_and_server_section(
        context):
    context.download_directory = "/downloads"
    context.driver_wrapper.config.set('Server', 'enabled', 'true')
    toolium.utils.download_files._get_download_directory_url = mock.Mock(
        return_value='https://host:8001')
    toolium.utils.download_files.makedirs_safe = mock.Mock(return_value=0)
    toolium.utils.download_files.urlretrieve = mock.Mock(return_value=0)

    assert retrieve_remote_downloaded_file(
        context, 'file_name') == '/downloads/file_name'
    toolium.utils.download_files.urlretrieve.assert_called_once_with(
        'https://host:8001/file_name', '/downloads/file_name')
コード例 #2
0
def test_retrieve_remote_downloaded_no_server_section(context):
    context.download_directory = 'donwload_path'
    context.driver_wrapper.config.remove_option('Server', 'enabled')

    assert retrieve_remote_downloaded_file(context, 'file_name') is None
コード例 #3
0
def test_retrieve_remote_downloaded_file_download_directory_none(context):
    context.download_directory = None

    assert retrieve_remote_downloaded_file(context, 'file_name') is None