Spaces:
Configuration error
Configuration error
Niranjan-Murugarasu024
feat: TradeSense AI Chairman Edition production release ready for Hugging Face Spaces
0125724 Download backend/tests/api/test_api.py from BlueMen/tradesenseAi: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/spaces/BlueMen/tradesenseAi/resolve/main/backend/tests/api/test_api.py
- Command line
-
hf download hf://spaces/BlueMen/tradesenseAi/backend/tests/api/test_api.py
-
curl -L -o test_api.py https://huggingface.co/spaces/BlueMen/tradesenseAi/resolve/main/backend/tests/api/test_api.py
1.16 kB
| """ | |
| TradeSense AI — FastAPI REST API Endpoint Tests | |
| """ | |
| import pytest | |
| from fastapi.testclient import TestClient | |
| from backend.app.main import app | |
| client = TestClient(app) | |
| def test_api_health(): | |
| """Verify GET /api/v1/health returns status HEALTHY.""" | |
| response = client.get("/api/v1/health") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert data["status"] == "HEALTHY" | |
| assert data["version"] == "1.3.0" | |
| assert data["stage_1_universe_count"] == 10 | |
| def test_api_calendar_sessions(): | |
| """Verify session calculator accurately resolves NSE trading days.""" | |
| response = client.get("/api/v1/calendar/sessions?target_date=2026-09-04") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert data["reference_date"] == "2026-09-04" | |
| assert data["next_trading_session"] == "2026-09-07" # Skips weekend to Monday trading session | |
| def test_api_journal_initial(): | |
| """Verify GET /api/v1/journal returns structure.""" | |
| response = client.get("/api/v1/journal") | |
| assert response.status_code == 200 | |
| data = response.json() | |
| assert "track_record" in data | |
| assert "entries" in data | |