الميزات: إضافة أدوات جديدة لمعالجة ملفات 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:
@@ -528,4 +528,107 @@ class TestUnlockPdf:
|
||||
data=data,
|
||||
content_type='multipart/form-data',
|
||||
)
|
||||
assert response.status_code == 202
|
||||
|
||||
|
||||
# =========================================================================
|
||||
# 9. Remove Watermark — POST /api/pdf-tools/remove-watermark
|
||||
# =========================================================================
|
||||
class TestRemoveWatermark:
|
||||
def test_no_file(self, client):
|
||||
"""Should return 400 when no file provided."""
|
||||
response = client.post('/api/pdf-tools/remove-watermark')
|
||||
assert response.status_code == 400
|
||||
|
||||
def test_success(self, client, monkeypatch):
|
||||
"""Should return 202 with task_id on valid PDF."""
|
||||
_mock_validate_and_task(
|
||||
monkeypatch, 'app.routes.pdf_tools', 'remove_watermark_task'
|
||||
)
|
||||
data = {'file': (io.BytesIO(b'%PDF-1.4'), 'test.pdf')}
|
||||
response = client.post(
|
||||
'/api/pdf-tools/remove-watermark',
|
||||
data=data,
|
||||
content_type='multipart/form-data',
|
||||
)
|
||||
assert response.status_code == 202
|
||||
|
||||
|
||||
# =========================================================================
|
||||
# 10. Reorder PDF — POST /api/pdf-tools/reorder
|
||||
# =========================================================================
|
||||
class TestReorderPdf:
|
||||
def test_no_file(self, client):
|
||||
"""Should return 400 when no file provided."""
|
||||
response = client.post('/api/pdf-tools/reorder')
|
||||
assert response.status_code == 400
|
||||
|
||||
def test_no_page_order(self, client, monkeypatch):
|
||||
"""Should return 400 when no page_order provided."""
|
||||
monkeypatch.setattr(
|
||||
'app.routes.pdf_tools.validate_actor_file',
|
||||
lambda f, allowed_types, actor: ('test.pdf', 'pdf'),
|
||||
)
|
||||
data = {'file': (io.BytesIO(b'%PDF-1.4'), 'test.pdf')}
|
||||
response = client.post(
|
||||
'/api/pdf-tools/reorder',
|
||||
data=data,
|
||||
content_type='multipart/form-data',
|
||||
)
|
||||
assert response.status_code == 400
|
||||
|
||||
def test_success(self, client, monkeypatch):
|
||||
"""Should return 202 with task_id on valid request."""
|
||||
_mock_validate_and_task(
|
||||
monkeypatch, 'app.routes.pdf_tools', 'reorder_pdf_task'
|
||||
)
|
||||
data = {
|
||||
'file': (io.BytesIO(b'%PDF-1.4'), 'test.pdf'),
|
||||
'page_order': '3,1,2',
|
||||
}
|
||||
response = client.post(
|
||||
'/api/pdf-tools/reorder',
|
||||
data=data,
|
||||
content_type='multipart/form-data',
|
||||
)
|
||||
assert response.status_code == 202
|
||||
|
||||
|
||||
# =========================================================================
|
||||
# 11. Extract Pages — POST /api/pdf-tools/extract-pages
|
||||
# =========================================================================
|
||||
class TestExtractPages:
|
||||
def test_no_file(self, client):
|
||||
"""Should return 400 when no file provided."""
|
||||
response = client.post('/api/pdf-tools/extract-pages')
|
||||
assert response.status_code == 400
|
||||
|
||||
def test_no_pages(self, client, monkeypatch):
|
||||
"""Should return 400 when no pages param provided."""
|
||||
monkeypatch.setattr(
|
||||
'app.routes.pdf_tools.validate_actor_file',
|
||||
lambda f, allowed_types, actor: ('test.pdf', 'pdf'),
|
||||
)
|
||||
data = {'file': (io.BytesIO(b'%PDF-1.4'), 'test.pdf')}
|
||||
response = client.post(
|
||||
'/api/pdf-tools/extract-pages',
|
||||
data=data,
|
||||
content_type='multipart/form-data',
|
||||
)
|
||||
assert response.status_code == 400
|
||||
|
||||
def test_success(self, client, monkeypatch):
|
||||
"""Should return 202 with task_id on valid request."""
|
||||
_mock_validate_and_task(
|
||||
monkeypatch, 'app.routes.pdf_tools', 'extract_pages_task'
|
||||
)
|
||||
data = {
|
||||
'file': (io.BytesIO(b'%PDF-1.4'), 'test.pdf'),
|
||||
'pages': '1,3,5-8',
|
||||
}
|
||||
response = client.post(
|
||||
'/api/pdf-tools/extract-pages',
|
||||
data=data,
|
||||
content_type='multipart/form-data',
|
||||
)
|
||||
assert response.status_code == 202
|
||||
Reference in New Issue
Block a user