الميزات: إضافة أدوات جديدة لمعالجة ملفات PDF، تشمل التلخيص والترجمة واستخراج الجداول.
- تفعيل مكون SummarizePdf لإنشاء ملخصات PDF باستخدام الذكاء الاصطناعي. - تفعيل مكون TranslatePdf لترجمة محتوى PDF إلى لغات متعددة. - تفعيل مكون TableExtractor لاستخراج الجداول من ملفات PDF. - تحديث الصفحة الرئيسية والتوجيه ليشمل الأدوات الجديدة. - إضافة ترجمات للأدوات الجديدة باللغات الإنجليزية والعربية والفرنسية. - توسيع أنواع واجهة برمجة التطبيقات (API) لدعم الميزات الجديدة المتعلقة بمعالجة ملفات PDF. --feat: Initialize frontend with React, Vite, and Tailwind CSS - Set up main entry point for React application. - Create About, Home, NotFound, Privacy, and Terms pages with SEO support. - Implement API service for file uploads and task management. - Add global styles using Tailwind CSS. - Create utility functions for SEO and text processing. - Configure Vite for development and production builds. - Set up Nginx configuration for serving frontend and backend. - Add scripts for cleanup of expired files and sitemap generation. - Implement deployment script for production environment.
This commit is contained in:
57
backend/tests/test_qrcode.py
Normal file
57
backend/tests/test_qrcode.py
Normal file
@@ -0,0 +1,57 @@
|
||||
"""Tests for QR Code Generator endpoint — POST /api/qrcode/generate."""
|
||||
import json
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
|
||||
class TestQrCodeGenerator:
|
||||
def test_no_data(self, client):
|
||||
"""Should return 400 when no data provided."""
|
||||
response = client.post(
|
||||
'/api/qrcode/generate',
|
||||
data=json.dumps({}),
|
||||
content_type='application/json',
|
||||
)
|
||||
assert response.status_code == 400
|
||||
|
||||
def test_success_json(self, client, monkeypatch):
|
||||
"""Should return 202 with task_id on valid JSON request."""
|
||||
mock_task = MagicMock()
|
||||
mock_task.id = 'qr-task-id'
|
||||
monkeypatch.setattr(
|
||||
'app.routes.qrcode.generate_qr_task',
|
||||
MagicMock(delay=MagicMock(return_value=mock_task)),
|
||||
)
|
||||
|
||||
response = client.post(
|
||||
'/api/qrcode/generate',
|
||||
data=json.dumps({'data': 'https://example.com', 'size': 300}),
|
||||
content_type='application/json',
|
||||
)
|
||||
assert response.status_code == 202
|
||||
json_data = response.get_json()
|
||||
assert 'task_id' in json_data
|
||||
|
||||
def test_success_form_data(self, client, monkeypatch):
|
||||
"""Should return 202 with task_id on valid form-data request."""
|
||||
mock_task = MagicMock()
|
||||
mock_task.id = 'qr-form-task-id'
|
||||
monkeypatch.setattr(
|
||||
'app.routes.qrcode.generate_qr_task',
|
||||
MagicMock(delay=MagicMock(return_value=mock_task)),
|
||||
)
|
||||
|
||||
response = client.post(
|
||||
'/api/qrcode/generate',
|
||||
data={'data': 'Hello World'},
|
||||
content_type='multipart/form-data',
|
||||
)
|
||||
assert response.status_code == 202
|
||||
|
||||
def test_empty_data(self, client):
|
||||
"""Should return 400 when data field is empty string."""
|
||||
response = client.post(
|
||||
'/api/qrcode/generate',
|
||||
data=json.dumps({'data': ''}),
|
||||
content_type='application/json',
|
||||
)
|
||||
assert response.status_code == 400
|
||||
Reference in New Issue
Block a user