Commit e3ce99f9 authored by Vuillaume's avatar Vuillaume
Browse files

Merge branch 'fix_get_ossr_records' into 'master'

Fix get ossr records

See merge request !215
parents 23924d13 1d3e5d47
Pipeline #181947 passed with stages
in 10 minutes and 48 seconds
......@@ -4,8 +4,8 @@
"name": "eossr",
"description": "<p align=\"left\"><img src=\"docs/images/eossr_logo.png\" width=\"400px\" ></p><h1>The ESCAPE OSSR library</h1><p>The eOSSR Python library gathers all the developments made for the OSSR. In particular, it includes:- an API to programmatically access the OSSR, retrieve records and publish content- functions to map and crosswalk metadata between the CodeMeta schema adopted for the OSSR and Zenodo internal schema- functions to help developers automatically contribute to the OSSR, in particular using their continuous integration (see also code snippets)</p><p>Code: <a href=\"\"></a>Documentation: <a href=\"\"></a></p><p><a href=\"\"><img alt=\"\" src=\"\" /></a><a href=\"\"><img alt=\"\" src=\"\" /></a><a href=\"\"><img alt=\"CII Best Practices\" src=\"\" /></a><a href=\"\"><img alt=\"\" src=\"\" /></a><a href=\"\"><img alt=\"\" src=\"\" /></a><a href=\"\"><img alt=\"\" src=\"\" /></a></p><h2>Former stable versions</h2><ul><li>v0.6: <a href=\"\"><img alt=\"DOI\" src=\"\" /></a></li><li>v0.5: <a href=\"\"><img alt=\"DOI\" src=\"\" /></a></li><li>v0.4: <a href=\"\"><img alt=\"DOI\" src=\"\" /></a></li><li>v0.3.3: <a href=\"\"><img alt=\"\" src=\"\" /></a></li><li>v0.2 : <a href=\"\"><img alt=\"\" src=\"\" /></a></li></ul><h2>Install</h2><p>Commands to be run in your terminal.</p><h3>For users</h3><pre><code>pip install eossr</code></pre><p>You can also run it with docker:</p><pre><code>docker run -it</code></pre><p><a href=\"\">Visit our registry</a> to see the available docker containers.</p><p>Note that <code>latest</code> tag always point to the latest stable released container.</p><h3>For developers</h3><pre><code>git clone install -e &quot;./eossr&quot;</code></pre><h4>Running tests</h4><p>To run tests locally, run:</p><pre><code>pip install -e &quot;./eossr[tests]&quot;pytest eossr</code></pre><p>Some tests will be skiped if <code>SANDBOX_ZENODO_TOKEN</code> is not defined in your environment variables.If you want to run these tests, you will need to create a <a href=\"\">sandbox zenodo token</a> and add it to your env:</p><pre><code>export SANDBOX_ZENODO_TOKEN=&quot;your_sandbox_token&quot;</code></pre><h2>License</h2><p>See <a href=\"LICENSE\">LICENSE</a></p><h2>Cite</h2><p>To cite this library, use the cite section in <a href=\"\">the Zenodo page</a> (rightcolumn, below the <code>Versions</code> section).</p>",
"license": "",
"version": "v0.7.dev17+gfccbba2",
"softwareVersion": "v0.7.dev17+gfccbba2",
"version": "v0.7.dev22+g2a70d3e",
"softwareVersion": "v0.7.dev22+g2a70d3e",
"codeRepository": "",
"developmentStatus": "active",
"isAccessibleForFree": true,
......@@ -43,11 +43,11 @@
"runtimePlatform": "Python 3",
"downloadUrl": "",
"downloadUrl": "",
"releaseNotes": "eossr v0.6 Minor bug fixes and documentation improvements. Full changelog:",
"dateCreated": "2021-08-31",
"datePublished": "2022-05-23",
"dateModified": "2022-05-23",
"datePublished": "2022-06-10",
"dateModified": "2022-06-10",
"operatingSystem": "",
"maintainer": {
"@type": "Person",
......@@ -42,7 +42,9 @@ def get_ossr_records(search='', sandbox=False, **kwargs):
# make sure we find all OSSR records without limit on the number
r = requests.get(zenodo_api_url + '/records', params={'communities': escape_community})
params = kwargs
params['communities'] = escape_community
r = requests.get(zenodo_api_url + '/records', params=params)
number_of_ossr_entries = r.json()['aggregations']['access_right']['buckets'][0]['doc_count']
kwargs['size'] = number_of_ossr_entries
......@@ -2,7 +2,7 @@ from eossr import api
def test_get_ossr_records():
ossr_records = api.get_ossr_records(all_versions=1)
ossr_records = api.get_ossr_records(all_versions=True)
assert len(ossr_records) >= 12 # number of records October 01, 2021
all_ids = [['id'] for rec in ossr_records]
assert 5524913 in all_ids # id of the version v0.2 of the eossr
......@@ -31,7 +31,7 @@ class TestZenodoApiSandbox(unittest.TestCase):
# getting all records for tests purposes
self.zenodo.parameters['size'] = 1000
self.zenodo.parameters['all_versions'] = 1
self.zenodo.parameters['all_versions'] = True
def test_initialization_sandbox(self):
assert isinstance(self.zenodo, ZenodoAPI)
......@@ -151,7 +151,7 @@ class TestZenodoAPIToken(unittest.TestCase):
def test_get_zenodo_records():
zenodo_records = get_zenodo_records('ESCAPE template project', all_versions=1)
zenodo_records = get_zenodo_records('ESCAPE template project', all_versions=True)
assert len(zenodo_records) > 1
all_dois = [['doi'] for r in zenodo_records]
assert '10.5281/zenodo.4923992' in all_dois
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment