def test_record_endpoint_by_db_pid(inspire_app): expected_endpoint = "authors" record = create_record("aut") cn = record["control_number"] pid = PersistentIdentifier(pid_type="recid", pid_value=str(cn)) endpoint = find_record_endpoint(pid) assert endpoint == expected_endpoint
def test_record_endpoint_by_schema_content(inspire_app): expected_endpoint = "institutions" record_hit_data = { "_source": { "$schema": "http://localhost:5000/schemas/records/institutions.json" } } pid = PersistentIdentifier(pid_type="recid", pid_value=1) endpoint = find_record_endpoint(pid, record_hit=record_hit_data) assert endpoint == expected_endpoint
def test_record_endpoint_by_internal_type(inspire_app): expected_endpoint = "literature" pid = PersistentIdentifier(pid_type="lit", pid_value=1) endpoint = find_record_endpoint(pid) assert endpoint == expected_endpoint