Commit 7e3939b4 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update test_01_InvenioStore

parent 715ea1c7
......@@ -165,9 +165,14 @@ class InspirehepStore(BaseStore):
or ``mostcited`` for ``literature``
Returns:
* list of JSON records
The record format is defined in:
https://inspire-schemas.readthedocs.io/en/latest/schemas/
* list of dict:
- id (str)
- created (str)
- links (dict)
- metadata (dict)
The record format is defined in:
https://inspire-schemas.readthedocs.io/en/latest/schemas/
- updated (str)
Raises:
CdsException:
......
......@@ -48,26 +48,17 @@ def test_get_ids_ins_01003():
"""Check the list of record ids for LHCb articles published in 2010.
"""
store = build_store("inspirehep.net")
query = "find cn lhcb and tc p and not tc c and date 2010"
kwargs = {"p": query, # query à la spires
"rg": 1000, # maximum number of records returned
"sf": "year", # sort by date
"so": "d"} # descending order
rec_ids = store.get_ids(**kwargs)
store = build_store("inspirehep.net", shelf="literature")
ids = store.get_ids(q="find cn lhcb and tc p and not tc c and date 2010")
ref_2019_ids = {865584, 867355, 867647}
assert set(rec_ids).difference(ref_2019_ids) == set()
assert set(ids) == ref_2019_ids
def test_get_ids_exception_01004():
store = build_store("inspirehep.net", shelf="conferences")
with pytest.raises(CdsException) as e_info:
store.get_ids(p="find cn lhcb")
assert store.get_ids(q="find cn lhcb") == []
def test_get_record_cds_01005():
......@@ -94,7 +85,7 @@ def test_get_record_ins_conferences_01008():
# new inspirehep interface for conferences
store = build_store("inspirehep.net", shelf="conferences")
recjson = store.get_record(980401)
assert recjson["metadata"]["cnum"] == "C10-12-06"
assert recjson["cnum"] == "C10-12-06"
def test_get_record_ins_institutions_01009():
......@@ -105,15 +96,13 @@ def test_get_record_ins_institutions_01009():
def test_get_field_ins_01010():
# old inspirehep interface (new one not yet available)
store = build_store("inspirehep.net", shelf="literature")
value = store.get_field(1319638, "number_of_citations")
assert str(value).isdigit()
value = store.get_field(1319638, "citation_count")
assert isinstance(value, int)
def test_search_ins_01011():
# new inspirehep interface for conferences
store = build_store("inspirehep.net", shelf="conferences")
obj = store.search("cnum:C10-12-06")
obj = store.search(q="cnum:C10-12-06")
assert len(obj) == 1 and obj[0]["metadata"]["cnum"] == "C10-12-06"
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