Skip to content
Snippets Groups Projects
Commit d091bbe6 authored by vuillaut's avatar vuillaut
Browse files

unit tests

parent 884de680
No related branches found
No related tags found
1 merge request!15api
Pipeline #135645 failed
from eossr import api
import pytest
@pytest.fixture
def test_ossr():
ossr = api.Ossr()
def test_get_ossr_records():
ossr_records = api.get_ossr_records()
assert len(ossr_records) >= 15 # number of records September 10, 2021
all_ids = [rec.data['id'] for rec in ossr_records]
assert 4923992 in all_ids # id of the ESCAPE template project
template_search = ossr.search('ESCAPE template project')
assert len(template_search) > 0
return template_search[0]
def test_pprint_record(test_ossr):
api.pprint_record(test_ossr)
def test_get_all_ossr_records():
ossr_records = api.get_all_ossr_records()
assert len(ossr_records) >= 15 # number of records September 10, 2021
\ No newline at end of file
......@@ -6,7 +6,7 @@ import requests
from pathlib import Path
from os import remove
from os.path import dirname, realpath, join
from eossr.api.zenodo import ZenodoAPI
from eossr.api.zenodo import ZenodoAPI, get_zenodo_records
ROOT_DIR = dirname(realpath("codemeta.json"))
......@@ -147,3 +147,10 @@ class TestZenodoAPI(unittest.TestCase):
json.load(f)
remove(z.path_zenodo_metadata_file)
def test_get_zenodo_records():
l = get_zenodo_records('ESCAPE template project')
assert len(l) > 1
all_dois = [r.data['doi'] for r in l]
assert '10.5281/zenodo.4923992' in all_dois
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment