mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-11-25 01:11:00 +00:00
add translate test (test if it work & models are downloaded)
This commit is contained in:
parent
99c6ceba43
commit
97ff47bc2b
1 changed files with 16 additions and 0 deletions
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 a new issue