from app import app

with app.test_request_context('/api/voices'):
    try:
        from app import api_voices
        result = api_voices()
        print("RESULT TYPE:", type(result))
        if isinstance(result, tuple):
            print("STATUS:", result[1] if len(result) > 1 else "no status")
            print("CONTENT:", result[0][:200] if result[0] else "empty")
        else:
            print("RESULT:", result)
    except Exception as e:
        print(f"EXCEPTION: {type(e).__name__}: {e}")
        import traceback
        traceback.print_exc()

# Also test with test client but with more detail
print("\n--- Test Client ---")
c = app.test_client()
r = c.get('/api/voices')
print(f"Status: {r.status_code}")
print(f"Headers: {dict(r.headers)}")

# Test a working endpoint for comparison
print("\n--- /api/runtime ---")
r2 = c.get('/api/runtime')
print(f"Status: {r2.status_code}")
