@pytest.mark.parametrize('doi,expected_err', [('junkjunkjunk', 'Invalid parameter value'), ('10.5281/zenodo.11111111111111111', 'Invalid parameter value')])
@pytest.mark.integration
@pytest.mark.service
@flaky(max_runs=30, min_passes=1)
def test_dataset_import_junk_job(doi, expected_err, svc_client_with_repo):
    'Test dataset import.'
    (svc_client, headers, project_id, url_components) = svc_client_with_repo
    user = {'user_id': headers['Renku-User-Id']}
    payload = {'project_id': project_id, 'dataset_uri': doi}
    response = svc_client.post('/datasets.import', data=json.dumps(payload), headers=headers)
    assert response
    assert_rpc_response(response)
    assert ({'job_id', 'created_at'} == set(response.json['result'].keys()))
    dest = make_project_path(user, {'owner': url_components.owner, 'name': url_components.name})
    old_commit = Repo(dest).head.commit
    job_id = response.json['result']['job_id']
    with pytest.raises(ParameterError):
        dataset_import(user, job_id, project_id, doi)
    new_commit = Repo(dest).head.commit
    assert (old_commit.hexsha == new_commit.hexsha)
    response = svc_client.get(f'/jobs/{job_id}', data=json.dumps(payload), headers=headers)
    assert_rpc_response(response)
    extras = response.json['result']['extras']
    assert ('error' in extras)
    assert (expected_err in extras['error'])
Test dataset import.
@pytest.mark.parametrize('doi,expected_err', [('junkjunkjunk', 'Invalid parameter value'), ('10.5281/zenodo.11111111111111111', 'Invalid parameter value')])
@pytest.mark.integration
@pytest.mark.service
@flaky(max_runs=30, min_passes=1)
def test_dataset_import_junk_job(doi, expected_err, svc_client_with_repo):
    
    (svc_client, headers, project_id, url_components) = svc_client_with_repo
    user = {'user_id': headers['Renku-User-Id']}
    payload = {'project_id': project_id, 'dataset_uri': doi}
    response = svc_client.post('/datasets.import', data=json.dumps(payload), headers=headers)
    assert response
    assert_rpc_response(response)
    assert ({'job_id', 'created_at'} == set(response.json['result'].keys()))
    dest = make_project_path(user, {'owner': url_components.owner, 'name': url_components.name})
    old_commit = Repo(dest).head.commit
    job_id = response.json['result']['job_id']
    with pytest.raises(ParameterError):
        dataset_import(user, job_id, project_id, doi)
    new_commit = Repo(dest).head.commit
    assert (old_commit.hexsha == new_commit.hexsha)
    response = svc_client.get(f'/jobs/{job_id}', data=json.dumps(payload), headers=headers)
    assert_rpc_response(response)
    extras = response.json['result']['extras']
    assert ('error' in extras)
    assert (expected_err in extras['error'])