Spaces:
Running
Running
| import pytest | |
| from fastapi.testclient import TestClient | |
| from app.main import app | |
| def client(): | |
| return TestClient(app) | |
| def test_health_check(client): | |
| response = client.get("/health") | |
| assert response.status_code == 200 | |
| assert response.json() == {"status": "ok"} | |
| def test_upload_rejects_invalid_file(client): | |
| response = client.post( | |
| "/api/upload", | |
| files={"file": ("test.txt", b"hello world", "text/plain")}, | |
| ) | |
| assert response.status_code == 400 | |
| assert "Invalid file type" in response.json()["detail"] | |
| def test_analyze_requires_session(client): | |
| response = client.post( | |
| "/api/analyze-job", | |
| json={"job_url": "https://example.com/job"}, | |
| ) | |
| assert response.status_code == 401 | |