Skip to content

Commit

Permalink
Merge pull request #323 from shoeffner/upload-file
Browse files Browse the repository at this point in the history
Allow check_upload assets to use docker
  • Loading branch information
adswa authored Aug 23, 2024
2 parents 0621e2d + 3251cf2 commit bf402b8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions datalad_dataverse/tests/test_pydataverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def test_file_handling(
dataverse_admin_api,
dataverse_dataaccess_api,
dataverse_dataset,
dataverse_instance_url,
):
# the starting point of `dataverse_dataset` is a freshly
# created, non-published dataset in draft mode, with no prior
Expand All @@ -41,7 +42,7 @@ def test_file_handling(

fileid = check_upload(
dataverse_admin_api,
dataverse_dataset, fcontent, fpath, src_md5)
dataverse_dataset, fcontent, fpath, src_md5, dataverse_instance_url)

check_download(
dataverse_dataaccess_api, fileid,
Expand Down Expand Up @@ -104,7 +105,7 @@ def check_duplicate_file_deposition(api, dsid, tmp_path):
for f in identicals)


def check_upload(api, dsid, fcontent, fpath, src_md5):
def check_upload(api, dsid, fcontent, fpath, src_md5, dv_url):
# the simplest possible upload, just a source file name
response = api.upload_datafile(
identifier=dsid,
Expand Down Expand Up @@ -140,7 +141,11 @@ def check_upload(api, dsid, fcontent, fpath, src_md5):
# TODO: seemingly discontinued between Dataverse 5.13 and 6.0?
#assert df['pidURL'] == ''
assert df['rootDataFileId'] == -1
assert df['storageIdentifier'].startswith('s3://demo-dataverse')

if 'localhost' in dv_url or '127.0.0.1' in dv_url:
assert df['storageIdentifier'].startswith('local://')
else:
assert df['storageIdentifier'].startswith('s3://demo-dataverse')

# report the file ID for external use
return df['id']
Expand Down

0 comments on commit bf402b8

Please sign in to comment.