feat(api): implement phase 2 expanded read endpoints

This commit is contained in:
2026-03-11 23:04:42 -04:00
parent e8303b819b
commit 1be576a9a0
4 changed files with 97 additions and 8 deletions

View File

@@ -0,0 +1,36 @@
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))