test(token_usage): migrate to send_result() (Phase 2.6)
The test_token_usage_tracking test calls ai_client.send() and verifies the comms log entry. Migrating to send_result() + assert result.ok. Changes: - Rename ai_client.send(...) to ai_client.send_result(...) - Add assert result.ok - Add "from src.result_types import Result" import 1 test passes.
This commit is contained in:
@@ -6,6 +6,7 @@ from types import SimpleNamespace
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
from src import ai_client
|
||||
from src.result_types import Result
|
||||
|
||||
def test_token_usage_tracking() -> None:
|
||||
ai_client.reset_session()
|
||||
@@ -31,7 +32,8 @@ def test_token_usage_tracking() -> None:
|
||||
mock_response.text = "Mock Response"
|
||||
mock_chat.send_message.return_value = mock_response
|
||||
ai_client.set_provider("gemini", "gemini-2.5-flash-lite")
|
||||
ai_client.send("Context", "Hello")
|
||||
result = ai_client.send_result("Context", "Hello")
|
||||
assert result.ok
|
||||
comms = ai_client.get_comms_log()
|
||||
response_entries = [e for e in comms if e.get("direction") == "IN" and e["kind"] == "response"]
|
||||
assert len(response_entries) > 0
|
||||
|
||||
Reference in New Issue
Block a user