From 93b53a32682d8c5392b41609e404dd3d72c810fa Mon Sep 17 00:00:00 2001 From: Enrique Noriega Date: Tue, 5 Sep 2023 17:57:32 -0700 Subject: [PATCH] Temporarily commented out unit tests (#442) This is a temporary fix to issue #441, while we mock the COSMOS service --- .../test_integrated_text_reading_proxy.py | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/skema/rest/tests/test_integrated_text_reading_proxy.py b/skema/rest/tests/test_integrated_text_reading_proxy.py index cd42ed5f573..3693721c57e 100644 --- a/skema/rest/tests/test_integrated_text_reading_proxy.py +++ b/skema/rest/tests/test_integrated_text_reading_proxy.py @@ -38,39 +38,41 @@ def test_text_integrated_extractions(): assert output.errors is None, f"Document {ix + 1} reported errors" -def test_integrated_pdf_extraction(): - """ Tests the pdf endpoint """ - params = { - "annotate_skema": True, - "annotate_mit": False - } - - path = Path(__file__).parents[0] / "data" / "integrated_text_reading" / "CHIME_SVIIvR_model.pdf" - with path.open("rb") as pdf: - files = [ - ("pdfs", ("CHIME_SVIIvR_model.pdf", pdf, "application/pdf")) - ] - - response = client.post(f"/integrated-pdf-extractions", params=params, files=files) - - assert response.status_code == 200 - - results = TextReadingAnnotationsOutput(**response.json()) - assert len(results.outputs) == 1, "The inputs doesn't have outputs" - assert results.generalized_errors is None, f"Generalized TR errors" - for ix, output in enumerate(results.outputs): - assert output.data is not None, f"Document {ix + 1} didn't generate AttributeCollection" - assert len(output.data.attributes) > 0, f"Document {ix + 1} generated an empty attribute collection" - assert output.errors is None, f"Document {ix + 1} reported errors" +## EN: Comment this out until we can mock the cosmos endpoint to decouple our unit test from the status of their service +# def test_integrated_pdf_extraction(): +# """ Tests the pdf endpoint """ +# params = { +# "annotate_skema": True, +# "annotate_mit": False +# } +# +# path = Path(__file__).parents[0] / "data" / "integrated_text_reading" / "CHIME_SVIIvR_model.pdf" +# with path.open("rb") as pdf: +# files = [ +# ("pdfs", ("CHIME_SVIIvR_model.pdf", pdf, "application/pdf")) +# ] +# +# response = client.post(f"/integrated-pdf-extractions", params=params, files=files) +# +# assert response.status_code == 200 +# +# results = TextReadingAnnotationsOutput(**response.json()) +# assert len(results.outputs) == 1, "The inputs doesn't have outputs" +# assert results.generalized_errors is None, f"Generalized TR errors" +# for ix, output in enumerate(results.outputs): +# assert output.data is not None, f"Document {ix + 1} didn't generate AttributeCollection" +# assert len(output.data.attributes) > 0, f"Document {ix + 1} generated an empty attribute collection" +# assert output.errors is None, f"Document {ix + 1} reported errors" # Test the cosmos endpoint -def test_cosmos(): - """Test that we are able to fetch COSMOS data correctly""" - path = Path(__file__).parents[0] / "data" / "integrated_text_reading" / "CHIME_SVIIvR_model.pdf" - with path.open("rb") as pdf: - ret = cosmos_client(path.name, pdf) - assert ret is not None and len(ret) > 0 +# EN: Commented this out as we don't control it (UWisc) +# def test_cosmos(): +# """Test that we are able to fetch COSMOS data correctly""" +# path = Path(__file__).parents[0] / "data" / "integrated_text_reading" / "CHIME_SVIIvR_model.pdf" +# with path.open("rb") as pdf: +# ret = cosmos_client(path.name, pdf) +# assert ret is not None and len(ret) > 0 def test_mira_grounding():