File size: 1,270 Bytes
3370983 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
"""
Test the CV upload functionality.
Run with:
>>> export PYTHONPATH=$PYTHONPATH:. && python3 scripts/db/test_cv_upload.py
"""
import os
from src.sdk.cv_upload import CVUploadClient
def test_upload():
client = CVUploadClient(base_url="http://localhost:8080/api/v1/cv")
cv_path = "src/backend/database/cvs/uploads/Sebastian_Wefers_CV.pdf"
if not os.path.exists(cv_path):
print(f"β CV file not found at {cv_path}")
return
print(f"π€ Uploading {cv_path}...")
try:
with open(cv_path, "rb") as f:
response = client.submit(
full_name="Test Candidate",
email="test_candidate@example.com",
phone="+1234567890",
cv_file=f,
filename="test_candidate.pdf"
)
if response.success:
print(f"β
Upload successful: {response.message}")
print(f"Details: {response}")
elif response.already_exists:
print(f"β οΈ Candidate already exists: {response.message}")
else:
print(f"β Upload failed: {response.message}")
except Exception as e:
print(f"β Error during upload: {e}")
if __name__ == "__main__":
test_upload()
|