from fastapi.testclient import TestClient
from nfl import app
import getpass

usuario = input("Usuario del panel: ")
clave = getpass.getpass("Contraseña del panel: ")

with TestClient(app) as client:
    respuesta = client.post(
        "/api/hermes/voice",
        json={
            "mensaje": "Soy Hérmes, mensajero del Olimpo. Mi voz ya está conectada."
        },
        auth=(usuario, clave),
        timeout=60
    )

    print("HTTP:", respuesta.status_code)

    if respuesta.status_code == 200:
        datos = respuesta.json()
        print("VOZ:", datos.get("voz"))
        print("AUDIO:", len(datos.get("audioBase64", "")), "caracteres")
        print("VISEMAS:", len(datos.get("visemas", [])))
        print("AZURE VOICE AUTENTICADA: OK")
    else:
        print("ERROR:", respuesta.json().get("detail"))
