From 97ff47bc2b9e5a8ae65d784fb3253ae5d01006d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Thuret?= Date: Sun, 3 Apr 2022 20:41:59 +0200 Subject: [PATCH] add translate test (test if it work & models are downloaded) --- tests/test_api/test_api_translate.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/test_api/test_api_translate.py diff --git a/tests/test_api/test_api_translate.py b/tests/test_api/test_api_translate.py new file mode 100644 index 0000000..0df0873 --- /dev/null +++ b/tests/test_api/test_api_translate.py @@ -0,0 +1,16 @@ +import json + + +def test_api_detect_language(client): + response = client.post("/translate", data={ + "q": "Hello", + "source": "en", + "target": "es", + "format": "text" + }) + + response_json = json.loads(response.data) + + assert "translatedText" in response_json + assert response.status_code == 200 +