feat(translate): refonte du design de la page de traduction et du sélecteur de moteurs (Etapes 1-3)
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m12s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 2m12s
This commit is contained in:
@@ -891,3 +891,23 @@ class TestAPIKeyAuth:
|
||||
headers={"X-API-Key": "test-api-key-placeholder"},
|
||||
)
|
||||
assert response.status_code in [202, 401]
|
||||
|
||||
|
||||
class TestTranslateImagesParameter:
|
||||
"""Test translate_images parameter in POST /api/v1/translate"""
|
||||
|
||||
def test_accepts_translate_images_parameter(self, authenticated_client):
|
||||
"""Endpoint accepts translate_images form parameter"""
|
||||
excel_content = create_valid_excel()
|
||||
response = authenticated_client.post(
|
||||
TRANSLATE_URL,
|
||||
files={
|
||||
"file": (
|
||||
"test.xlsx",
|
||||
io.BytesIO(excel_content),
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
)
|
||||
},
|
||||
data={"target_lang": "fr", "translate_images": "true"},
|
||||
)
|
||||
assert response.status_code == 202
|
||||
|
||||
@@ -613,21 +613,14 @@ class TestWriteErrorHandling:
|
||||
input_file = tmp_path / "input.docx"
|
||||
doc.save(input_file)
|
||||
|
||||
readonly_dir = tmp_path / "readonly"
|
||||
readonly_dir.mkdir()
|
||||
# Create a file instead of a directory to force a write error on both Windows and Unix
|
||||
readonly_dir = tmp_path / "readonly_file"
|
||||
readonly_dir.write_text("blocked")
|
||||
output_file = readonly_dir / "output.docx"
|
||||
|
||||
import os
|
||||
import stat
|
||||
|
||||
os.chmod(readonly_dir, stat.S_IRUSR | stat.S_IXUSR)
|
||||
|
||||
try:
|
||||
with pytest.raises(WordProcessorError) as exc_info:
|
||||
translator.translate_file(input_file, output_file, "fr")
|
||||
assert exc_info.value.code == WordProcessorError.DOCX_WRITE_ERROR
|
||||
finally:
|
||||
os.chmod(readonly_dir, stat.S_IRWXU)
|
||||
with pytest.raises(WordProcessorError) as exc_info:
|
||||
translator.translate_file(input_file, output_file, "fr")
|
||||
assert exc_info.value.code == WordProcessorError.DOCX_WRITE_ERROR
|
||||
|
||||
|
||||
class TestMultipleSections:
|
||||
|
||||
Reference in New Issue
Block a user