From ffdf544ee42306dae3474734b0db3d282d7e6313 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Wed, 27 Jul 2022 17:40:14 -0700 Subject: [PATCH 1/2] Support pulling from zenodo sandbox too Test uploads should go to the sandbox, rather than to main zenodo. The installation is exactly the same. --- repo2docker/contentproviders/zenodo.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/repo2docker/contentproviders/zenodo.py b/repo2docker/contentproviders/zenodo.py index f0e4cb94..7a5d0932 100644 --- a/repo2docker/contentproviders/zenodo.py +++ b/repo2docker/contentproviders/zenodo.py @@ -20,6 +20,17 @@ class Zenodo(DoiProvider): # filepath (path to files in metadata), filename (path to filename in # metadata), download (path to file download URL), and type (path to item type in metadata) self.hosts = [ + { + "hostname": [ + "https://sandbox.zenodo.org/record/", + "http://sandbox.zenodo.org/record/", + ], + "api": "https://sandbox.zenodo.org/api/records/", + "filepath": "files", + "filename": "filename", + "download": "links.download", + "type": "metadata.upload_type", + }, { "hostname": ["https://zenodo.org/record/", "http://zenodo.org/record/"], "api": "https://zenodo.org/api/records/", From b97db1066d2630eb6e18d33f2346cb27e57277b0 Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Thu, 28 Jul 2022 10:02:10 -0700 Subject: [PATCH 2/2] Fix indexes in tests that look for staging zenodo --- tests/unit/contentproviders/test_zenodo.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/contentproviders/test_zenodo.py b/tests/unit/contentproviders/test_zenodo.py index 99ce4fc6..c46cf8d9 100644 --- a/tests/unit/contentproviders/test_zenodo.py +++ b/tests/unit/contentproviders/test_zenodo.py @@ -46,7 +46,7 @@ test_hosts = [ "10.5281/zenodo.3232985", "https://doi.org/10.5281/zenodo.3232985", ], - {"host": test_zen.hosts[0], "record": "3232985"}, + {"host": test_zen.hosts[1], "record": "3232985"}, ), ( [ @@ -54,7 +54,7 @@ test_hosts = [ "10.22002/d1.1235", "https://doi.org/10.22002/d1.1235", ], - {"host": test_zen.hosts[1], "record": "1235"}, + {"host": test_zen.hosts[2], "record": "1235"}, ), ] @@ -107,7 +107,7 @@ def test_fetch_software_from_github_archive(requests_mock): ) zen = Zenodo() - spec = {"host": test_zen.hosts[0], "record": "1234"} + spec = {"host": test_zen.hosts[1], "record": "1234"} with TemporaryDirectory() as d: output = [] @@ -141,7 +141,7 @@ def test_fetch_software(requests_mock): with TemporaryDirectory() as d: zen = Zenodo() - spec = spec = {"host": test_zen.hosts[0], "record": "1234"} + spec = spec = {"host": test_zen.hosts[1], "record": "1234"} output = [] for l in zen.fetch(spec, d): output.append(l) @@ -178,7 +178,7 @@ def test_fetch_data(requests_mock): with TemporaryDirectory() as d: zen = Zenodo() - spec = {"host": test_zen.hosts[0], "record": "1234"} + spec = {"host": test_zen.hosts[1], "record": "1234"} output = [] for l in zen.fetch(spec, d): output.append(l)