File size: 929 Bytes
6f10462 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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"]}')
|