From ab33375901d83483e348d92423b4432495b8fecd Mon Sep 17 00:00:00 2001 From: Juho Inkinen <34240031+juhoinkinen@users.noreply.github.com> Date: Fri, 12 Apr 2024 11:28:35 +0300 Subject: [PATCH] Add test for empty RequestBody to suggest request --- tests/test_openapi.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_openapi.py b/tests/test_openapi.py index 76f33695f..d7f347809 100644 --- a/tests/test_openapi.py +++ b/tests/test_openapi.py @@ -83,6 +83,15 @@ def test_openapi_suggest_novocab(app_client): assert req.status_code == 503 +def test_openapi_suggest_emptybody(app_client): + data = {} + req = app_client.post( + "http://localhost:8000/v1/projects/dummy-fi/suggest", data=data + ) + assert req.status_code == 400 + assert req.json()["detail"] == "RequestBody is required" + + def test_openapi_suggest_batch(app_client): data = {"documents": [{"text": "A quick brown fox jumped over the lazy dog."}] * 32} req = app_client.post(