test(server): add OCR endpoint and service tests

New tests:
- server/tests/test_ocr_endpoints.py: OCR API endpoint tests
- server/tests/test_ocr_service.py: OCR service unit tests

Updated tests:
- server/tests/test_openapi_schema.py: update OpenAPI schema tests
- server/tests/test_orchestrator_service.py: update orchestrator service tests
This commit is contained in:
caoxiaozhu
2026-05-12 03:05:05 +00:00
parent fb23a6976a
commit a3f3421ebc
4 changed files with 189 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ def test_openapi_schema_includes_documented_backend_routes() -> None:
assert schema["info"]["title"] == get_settings().app_name
assert any(tag["name"] == "agent-assets" for tag in schema["tags"])
assert any(tag["name"] == "knowledge" for tag in schema["tags"])
assert any(tag["name"] == "ocr" for tag in schema["tags"])
assert any(tag["name"] == "ontology" for tag in schema["tags"])
assert any(tag["name"] == "orchestrator" for tag in schema["tags"])
@@ -27,6 +28,10 @@ def test_openapi_schema_includes_documented_backend_routes() -> None:
assert knowledge_callback_post["summary"] == "接收 ONLYOFFICE 回调"
assert "application/json" in knowledge_callback_post["requestBody"]["content"]
ocr_post = schema["paths"]["/api/v1/ocr/recognize"]["post"]
assert ocr_post["summary"] == "识别票据或图片 OCR"
assert "multipart/form-data" in ocr_post["requestBody"]["content"]
ontology_parse_post = schema["paths"]["/api/v1/ontology/parse"]["post"]
assert ontology_parse_post["summary"] == "解析自然语言为语义本体"
assert "application/json" in ontology_parse_post["requestBody"]["content"]