alessandro trinca tornidor
commited on
Commit
·
428ed79
1
Parent(s):
224f2bb
test: fix test case for python 3.13
Browse files- tests/test_app.py +9 -1
tests/test_app.py
CHANGED
|
@@ -14,6 +14,7 @@ from my_ghost_writer.app import app, mongo_health_check_background_task, lifespa
|
|
| 14 |
# Import the module we want to test directly
|
| 15 |
from my_ghost_writer import __version__ as version_module
|
| 16 |
from my_ghost_writer.app import app, mongo_health_check_background_task, lifespan
|
|
|
|
| 17 |
from tests import EVENTS_FOLDER
|
| 18 |
|
| 19 |
|
|
@@ -272,9 +273,16 @@ class TestAppEndpoints(unittest.TestCase):
|
|
| 272 |
)
|
| 273 |
|
| 274 |
def test_get_synonyms_for_phrase_error_validation(self):
|
|
|
|
| 275 |
response = self.client.post("/thesaurus-inflated-phrase", json={})
|
| 276 |
self.assertEqual(response.status_code, 422)
|
| 277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
|
| 279 |
@patch("my_ghost_writer.text_parsers2.nlp", new=None)
|
| 280 |
def test_get_synonyms_for_phrase_error_nlp_none(self):
|
|
|
|
| 14 |
# Import the module we want to test directly
|
| 15 |
from my_ghost_writer import __version__ as version_module
|
| 16 |
from my_ghost_writer.app import app, mongo_health_check_background_task, lifespan
|
| 17 |
+
from my_ghost_writer.constants import app_logger
|
| 18 |
from tests import EVENTS_FOLDER
|
| 19 |
|
| 20 |
|
|
|
|
| 273 |
)
|
| 274 |
|
| 275 |
def test_get_synonyms_for_phrase_error_validation(self):
|
| 276 |
+
from http.client import responses
|
| 277 |
response = self.client.post("/thesaurus-inflated-phrase", json={})
|
| 278 |
self.assertEqual(response.status_code, 422)
|
| 279 |
+
response_json = response.json()
|
| 280 |
+
app_logger.info(f"responses_422:'{responses[422]}'")
|
| 281 |
+
app_logger.info(f"response_json:'{response_json}'")
|
| 282 |
+
try:
|
| 283 |
+
self.assertIn("Unprocessable Entity", response_json["detail"])
|
| 284 |
+
except AssertionError:
|
| 285 |
+
self.assertIn("Unprocessable Content", response_json["detail"])
|
| 286 |
|
| 287 |
@patch("my_ghost_writer.text_parsers2.nlp", new=None)
|
| 288 |
def test_get_synonyms_for_phrase_error_nlp_none(self):
|