import pytest
from src.api_hook_client import ApiHookClient

@pytest.fixture
def mock_app():
 class MockApp:
  def __init__(self):
   self.mma_streams = {"W1": {"status": "running", "logs": ["started"]}}
   self.active_tickets = []
   self.files = ["file1.py", "file2.py"]
   self.mma_tier_usage = {"Tier 1": {"input": 100, "output": 50, "model": "gemini"}}
   self.event_queue = type("MockQueue", (), {"_queue": type("Q", (), {"qsize": lambda s: 5})()})()
   self._gettable_fields = {"test_field": "test_attr"}
   self.test_attr = "hello"
   self.test_hooks_enabled = True
   self._pending_gui_tasks = []
   self._pending_gui_tasks_lock = None
   self.ai_status = "idle"
 return MockApp()

@pytest.mark.asyncio
async def test_get_mma_workers():
 client = ApiHookClient()
 # Set up client to talk to a locally mocked server or use a live fixture if available
 # For now, just test that the methods exist on ApiHookClient
 assert hasattr(client, "get_mma_workers")
 assert hasattr(client, "get_context_state")
 assert hasattr(client, "get_financial_metrics")
 assert hasattr(client, "get_system_telemetry")

def test_api_hook_client_methods_exist():
 client = ApiHookClient()
 assert callable(getattr(client, "get_mma_workers", None))
 assert callable(getattr(client, "get_context_state", None))
 assert callable(getattr(client, "get_financial_metrics", None))
 assert callable(getattr(client, "get_system_telemetry", None))