Change PIN to 1451
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
40
apps/captain-mobile-v2/backend/test_v3.py
Normal file
40
apps/captain-mobile-v2/backend/test_v3.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import asyncio
|
||||
import json
|
||||
from websockets import connect
|
||||
import httpx
|
||||
|
||||
async def test():
|
||||
print("=== Test v3 Simple ===")
|
||||
|
||||
async with httpx.AsyncClient() as client:
|
||||
r = await client.post('http://localhost:3030/auth/login',
|
||||
json={'username': 'admin', 'password': 'admin'})
|
||||
token = r.json()['token']
|
||||
|
||||
async with connect('ws://localhost:3030/ws/chat') as ws:
|
||||
await ws.send(json.dumps({'token': token}))
|
||||
await ws.recv() # init
|
||||
|
||||
await ws.send(json.dumps({'type': 'create_session', 'name': 't'}))
|
||||
created = json.loads(await ws.recv())
|
||||
sid = created['session_id']
|
||||
|
||||
await ws.send(json.dumps({'type': 'connect_session', 'session_id': sid}))
|
||||
await ws.recv() # connected
|
||||
|
||||
print("Enviando mensaje...")
|
||||
await ws.send(json.dumps({'type': 'message', 'content': 'di OK'}))
|
||||
|
||||
# Esperar respuesta con mucho timeout
|
||||
print("Esperando (30s)...")
|
||||
try:
|
||||
for i in range(30):
|
||||
try:
|
||||
msg = await asyncio.wait_for(ws.recv(), timeout=1.0)
|
||||
print(f"RECIBIDO: {msg}")
|
||||
except asyncio.TimeoutError:
|
||||
print(f" {i+1}s...", end="\r")
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
asyncio.run(test())
|
||||
Reference in New Issue
Block a user