def test_reference_structure(model, identifier='17112311'): response = json.loads(model.reference(reference_identifier=identifier)) assert response is not None check_reference(response) assert 'bibentry' in response assert 'related_references' in response assert 'abstract' in response assert 'authors' in response assert 'reftypes' in response assert 'counts' in response assert 'go' in response['counts'] assert 'regulation' in response['counts'] assert 'interaction' in response['counts'] assert 'phenotype' in response['counts'] for url in response['urls']: check_url(url) for related_ref in response['related_references']: #check_reference(related_ref) #Not embedded as a full reference assert 'abstract' in related_ref assert 'reftypes' in related_ref for author in response['authors']: check_obj(author) assert 'format_name' in author
def check_reference(reference): check_obj(reference) assert 'pubmed_id' in reference assert 'year' in reference assert 'journal' in reference assert 'citation' in reference assert 'format_name' in reference assert 'urls' in reference for url in reference['urls']: check_url(url)