feat(events): Add EventEmitter and instrument ai_client.py
This commit is contained in:
20
tests/test_api_events.py
Normal file
20
tests/test_api_events.py
Normal 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"})
|
||||
Reference in New Issue
Block a user