cv-analyser / comprehensive_test.py
Dzunisani007's picture
Fix CV Analyser database schema alignment and deployment readiness
c82a05c
import requests
import json
import time
base_url = 'http://localhost:7860'
print('πŸ” Running comprehensive API tests...')
# Test 1: Health check
health = requests.get(f'{base_url}/health').json()
print(f'βœ… Health: Database={health["db"]["ok"]}, Storage={health["storage"]["mode"]}, Models={health["models"]["mode"]}')
# Test 2: All available routes
app_response = requests.get(f'{base_url}/').json()
print(f'βœ… Root endpoint: {app_response["message"]}')
# Test 3: Detailed analysis with rich content
payload = {
'cv_text': '''Sarah Johnson
Senior Full Stack Developer
Email: sarah.johnson@email.com | Phone: +1-555-0123 | LinkedIn: linkedin.com/in/sarahjohnson
PROFESSIONAL SUMMARY
Experienced Full Stack Developer with 7 years of expertise in building scalable web applications.
Proficient in Python, JavaScript, React, and cloud technologies.
WORK EXPERIENCE
Senior Developer - TechCorp Inc. (2020-Present)
- Led development of microservices architecture serving 1M+ users
- Improved system performance by 45% through optimization
- Mentored team of 5 junior developers
- Implemented CI/CD pipelines reducing deployment time by 60%
Full Stack Developer - StartupXYZ (2018-2020)
- Built RESTful APIs and responsive web applications
- Collaborated in agile development environment
- Integrated third-party payment systems
EDUCATION
Bachelor of Science in Computer Science
University of Technology (2014-2018)
SKILLS
- Programming: Python, JavaScript, TypeScript, SQL
- Frontend: React, Vue.js, HTML5, CSS3
- Backend: Django, Node.js, Express, FastAPI
- Database: PostgreSQL, MongoDB, Redis
- Cloud: AWS, Docker, Kubernetes
- Tools: Git, Jenkins, Jira''',
'job_description': '''Senior Full Stack Developer
We are seeking an experienced Senior Full Stack Developer to join our growing engineering team.
REQUIREMENTS:
- 5+ years of full stack development experience
- Strong proficiency in Python and JavaScript
- Experience with React or similar frontend frameworks
- Backend development with Django/Node.js
- Database design and optimization skills
- Cloud platform experience (AWS preferred)
- Leadership and mentoring capabilities
RESPONSIBILITIES:
- Design and develop scalable web applications
- Lead technical projects and mentor team members
- Collaborate with cross-functional teams
- Implement best practices and code quality standards
- Participate in architecture decisions
BENEFITS:
- Competitive salary and equity
- Remote work flexibility
- Professional development budget
- Health, dental, and vision insurance'''
}
print('πŸš€ Submitting comprehensive analysis...')
response = requests.post(f'{base_url}/api/v1/analyze', json=payload, timeout=30)
result = response.json()
print(f'βœ… Analysis submitted: {result["analysis_id"]}')
# Poll for completion
analysis_id = result['analysis_id']
for i in range(20):
status = requests.get(f'{base_url}/api/v1/analyze/{analysis_id}/status').json()
if status['status'] == 'completed':
break
print(f'⏳ Processing... ({i+1}/20)')
time.sleep(2)
# Get detailed results
results = requests.get(f'{base_url}/api/v1/analyze/{analysis_id}/result').json()
print(f'πŸ“Š ANALYSIS RESULTS:')
print(f' Overall Score: {results["match_analysis"]["overall_score"]:.1f}%')
print(f' Skills Found: {len(results["structured_data"]["skills"])}')
print(f' Work Experience: {len(results["structured_data"]["work_experience"])} entries')
print(f' Education: {len(results["structured_data"]["education"])} entries')
if 'skills_match' in results['match_analysis']:
print(f' Skills Match: {len(results["match_analysis"]["skills_match"]["matched"])} matched')
print(f'🎯 Service is ready for recruitment app integration!')