This commit adds a dataladification test which uses an http-URL instead of https (since there is no https support in the server yet). Due to http usage, the final cloning step will fail when attempting to donwload an annex-location
40 lines
1 KiB
Python
40 lines
1 KiB
Python
from __future__ import annotations
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from datalad.api import download
|
|
from datalad_next.exceptions import IncompleteResultsError
|
|
from datalad_next.tests.utils import assert_status
|
|
|
|
from ..fixtures import (
|
|
dataaccess_credential,
|
|
data_webserver,
|
|
test_studies_dir,
|
|
test_study_names,
|
|
)
|
|
|
|
|
|
def test_example_unauthorized(data_webserver):
|
|
with pytest.raises(IncompleteResultsError):
|
|
download(
|
|
f'{data_webserver}/study_1/visit_a_dicom.tar',
|
|
result_renderer='disabled')
|
|
|
|
|
|
def test_example_authorized(
|
|
data_webserver, tmp_path: Path, tmp_keyring,
|
|
dataaccess_credential, credman,
|
|
):
|
|
credman.set(**dataaccess_credential)
|
|
|
|
target_file = tmp_path / 'visit_a_dicom.tar'
|
|
|
|
results = download(
|
|
{f'{data_webserver}/study_1/visit_a_dicom.tar': target_file},
|
|
credential=dataaccess_credential['name'],
|
|
result_renderer='disabled',
|
|
on_failure='ignore',
|
|
)
|
|
assert_status('ok', results)
|
|
assert target_file.exists()
|