"""Tests for /api/gui_health endpoint with the live_gui subprocess. The endpoint must be reachable from a real sloppy.py subprocess and return a healthy dict when the GUI is running normally. """ import pytest import sys import os import time sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from src.api_hook_client import ApiHookClient def test_live_gui_health_endpoint_returns_healthy(live_gui) -> None: """A fresh live_gui subprocess reports healthy=True on the health endpoint.""" client = ApiHookClient() assert client.wait_for_server(timeout=10) health = client.get_gui_health() assert health["healthy"] is True assert health["degraded_reason"] is None assert health["last_assert"] is None