#NEWLINE# def test_search( ) : #NEWLINE# #INDENT# search_json_response = '\n    {\n        "message-version": "1.0.0",\n        "message": {\n            "facets": {},\n            "query": {\n                "start-index": 0,\n                "search-terms": "test"\n            },\n            "total-results": 1,\n            "items": [{\n                "source": "CrossRef",\n                "title": ["Test Citation"],\n                "type": "dissertation", "URL": "http://dx.doi.org/test.doi",\n                "deposited": {"timestamp": 1000, "date-parts": [[2015, 1, 1]]},\n                "container-title": [],\n                "author": [{"given": "Test", "affiliation": [], "family": "Test"}],\n                "reference-count": 0,\n                "member": "http://id.crossref.org/member/xxx",\n                "subtitle": [],\n                "indexed": { "timestamp": 1000, "date-parts": [[2015, 1, 1]] },\n                "prefix": "http://id.crossref.org/prefix/test",\n                "publisher": "Test Publisher",\n                "score": 1.0,\n                "DOI": "test.doi",\n                "issued": { "date-parts": [[]] }\n            }]\n        }\n    }\n    ' #NEWLINE# with requests_mock . mock ( ) as m : #NEWLINE# #INDENT# m . get ( 'http://api.crossref.org/works' , text = search_json_response ) #NEWLINE# entries = utils . search ( 'test.doi' ) #NEWLINE# print ( entries ) #NEWLINE# #UNINDENT# assert_that ( len ( m ) , equal_to ( 1 ) ) #NEWLINE# entry = entries [ 0 ] #NEWLINE# assert_that ( entry [ 'title' ] , equal_to ( [ 'Test Citation' ] ) )