41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Simple test script to verify job processing works
|
|
"""
|
|
import sys
|
|
import os
|
|
sys.path.append(os.path.dirname(__file__))
|
|
|
|
from pdf_renamer import app, process_job, job_queue
|
|
import tempfile
|
|
import uuid
|
|
|
|
# Create app context for testing
|
|
with app.app_context():
|
|
# Create a test job with dummy files
|
|
job_id = str(uuid.uuid4())
|
|
job_queue[job_id] = {
|
|
'status': 'queued',
|
|
'files': [],
|
|
'zip_path': None,
|
|
'zip_name': None,
|
|
'processed_files': [],
|
|
'skipped': []
|
|
}
|
|
|
|
# Create some dummy file entries (they don't need to exist for this test)
|
|
file_list = [
|
|
{'name': 'test1.pdf', 'path': '/tmp/test1.pdf'},
|
|
{'name': 'test2.pdf', 'path': '/tmp/test2.pdf'}
|
|
]
|
|
|
|
job_queue[job_id]['files'] = file_list
|
|
|
|
print(f"Testing job processing for job_id: {job_id}")
|
|
print("Calling process_job...")
|
|
|
|
# Call process_job directly
|
|
process_job(job_id, file_list)
|
|
|
|
print("process_job completed")
|
|
print(f"Final job status: {job_queue[job_id]['status']}") |