| from app.routes import app | |
| with app.test_client() as client: | |
| print('Testing /api/statistics...') | |
| response = client.get('/api/statistics') | |
| print(f'Status Code: {response.status_code}') | |
| if response.status_code != 200: | |
| print(f'Error Response:') | |
| print(response.get_data(as_text=True)[:1000]) | |
| else: | |
| data = response.get_json() | |
| print(f'\n✅ API SUCCESS!') | |
| print(f'Total Cases: {data.get("total_cases", 0)}') | |
| print(f'Total PN: {data.get("total_pn", 0)}') | |
| print(f'City Options: {len(data.get("city_options", []))}') | |
| print(f'Year Options: {len(data.get("year_options", []))}') | |
| print(f'Crime Types: {len(data.get("crime_types", []))}') | |
| if data.get("city_options"): | |
| print(f'\nFirst 5 Cities:') | |
| for city in data["city_options"][:5]: | |
| print(f' - {city["label"]}') | |