Пример #1
0
def test_args_download_defaults(monkeypatch, mocker):
    """Test args_download does the correct thing."""
    entry = {
        'assembly_accession': 'FAKE0.1',
        'organism_name': 'Example species',
        'infraspecific_name': 'strain=ABC 1234',
        'ftp_path': 'https://fake/genomes/FAKE0.1'
    }
    worker_mock = mocker.MagicMock()
    select_candidates_mock = mocker.MagicMock(return_value=[(entry, 'bacteria')])
    create_downloadjob_mock = mocker.MagicMock(return_value=[core.DownloadJob(None, None, None, None)])
    monkeypatch.setattr(core, 'select_candidates', select_candidates_mock)
    monkeypatch.setattr(core, 'create_downloadjob', create_downloadjob_mock)
    monkeypatch.setattr(core, 'worker', worker_mock)
    assert core.args_download(Namespace()) == 0
    assert select_candidates_mock.call_args_list[0][0][0].group == SUPPORTED_TAXONOMIC_GROUPS
    assert create_downloadjob_mock.call_args_list[0][0][0] == entry
Пример #2
0
def test_args_download_defaults(monkeypatch, mocker):
    """Test args_download does the correct thing."""
    entry = {
        'assembly_accession': 'FAKE0.1',
        'organism_name': 'Example species',
        'infraspecific_name': 'strain=ABC 1234',
        'ftp_path': 'https://fake/genomes/FAKE0.1'
    }
    worker_mock = mocker.MagicMock()
    select_candidates_mock = mocker.MagicMock(return_value=[(entry, 'bacteria')])
    create_downloadjob_mock = mocker.MagicMock(return_value=[core.DownloadJob(None, None, None, None)])
    monkeypatch.setattr(core, 'select_candidates', select_candidates_mock)
    monkeypatch.setattr(core, 'create_downloadjob', create_downloadjob_mock)
    monkeypatch.setattr(core, 'worker', worker_mock)
    assert core.args_download(Namespace()) == 0
    assert select_candidates_mock.call_args_list[0][0][0].group == SUPPORTED_TAXONOMIC_GROUPS
    assert create_downloadjob_mock.call_args_list[0][0][0] == entry