mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-08-21 13:50:13 +02:00
add translate test (test if it work & models are downloaded)
This commit is contained in:
parent
99c6ceba43
commit
97ff47bc2b
16
tests/test_api/test_api_translate.py
Normal file
16
tests/test_api/test_api_translate.py
Normal file
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user