def test_ko_response(self): """A 500 response from GROBID yields a GrobidRequestError.""" url = os.path.join(current_app.config.get('GROBID_HOST'), 'processFulltextDocument') httpretty.register_uri(httpretty.POST, url, status=500) with pytest.raises(GrobidRequestError): process_pdf_stream(self.pdf)
def test_ko_response(current_app, httppretty_mock, sample_pdf): """A 500 response from GROBID yields a GrobidRequestError.""" current_app.config = { 'GROBID_HOST': 'http://localhost:8080' } url = os.path.join(current_app.config.get("GROBID_HOST"), "processFulltextDocument") httpretty.register_uri(httpretty.POST, url, status=500) with pytest.raises(GrobidRequestError): process_pdf_stream(sample_pdf)
def test_ok_response(self): """A valid pdf results in a valid response from GROBID.""" url = os.path.join(current_app.config.get('GROBID_HOST'), 'processFulltextDocument') httpretty.register_uri(httpretty.POST, url, body='OK') self.assertEqual(process_pdf_stream(self.pdf), 'OK')
def test_ok_response(current_app, httppretty_mock, sample_pdf): """A valid pdf results in a valid response from GROBID.""" current_app.config = { 'GROBID_HOST': 'http://localhost:8080' } url = os.path.join(current_app.config.get("GROBID_HOST"), "processFulltextDocument") httpretty.register_uri(httpretty.POST, url, body='OK') assert process_pdf_stream(sample_pdf) == 'OK'