feat(events): Add EventEmitter and instrument ai_client.py

This commit is contained in:
2026-02-23 16:23:55 -05:00
parent 93e72b5530
commit cd3f3c89ed
3 changed files with 38 additions and 0 deletions

20
tests/test_api_events.py Normal file
View File

@@ -0,0 +1,20 @@
import pytest
from unittest.mock import MagicMock
import ai_client
def test_ai_client_event_emitter_exists():
# This should fail initially because 'events' won't exist on ai_client
assert hasattr(ai_client, 'events')
assert ai_client.events is not None
def test_event_emission():
# We'll expect these event names based on the spec
mock_callback = MagicMock()
ai_client.events.on("request_start", mock_callback)
# Trigger something that should emit the event (once implemented)
# For now, we just test the emitter itself if we were to call it manually
ai_client.events.emit("request_start", payload={"model": "test"})
mock_callback.assert_called_once_with(payload={"model": "test"})