From a126e2cf17146746aa77a0ab513f648edea6f282 Mon Sep 17 00:00:00 2001 From: Daniel Visca Date: Tue, 17 Nov 2026 13:03:06 -0800 Subject: [PATCH] test(ai): read cache write token assertions from capture_ai The cache_write_tokens tests added in #1268 were written before 8.0 moved AI events to capture_ai, so they read mock_client.capture and fail on main. Co-Authored-By: Claude Opus 5.5 Generated-By: PostHog Desktop Task-Id: a72b68c8-37a1-47ee-8b69-6c44f59250b2 --- posthog/test/ai/openai/test_openai.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/posthog/test/ai/openai/test_openai.py b/posthog/test/ai/openai/test_openai.py index 14fbe55f5..31aa4c14b 100644 --- a/posthog/test/ai/openai/test_openai.py +++ b/posthog/test/ai/openai/test_openai.py @@ -679,7 +679,7 @@ def test_responses_cache_write_tokens( if stream: list(result) - props = mock_client.capture.call_args[1]["properties"] + props = mock_client.capture_ai.call_args[1]["properties"] assert props["$ai_input_tokens"] == 100 assert props["$ai_cache_read_input_tokens"] == 20 assert props["$ai_cache_creation_input_tokens"] == 50 @@ -721,7 +721,7 @@ def test_chat_cache_write_tokens(mock_client, mock_openai_response, stream): if stream: list(result) - props = mock_client.capture.call_args[1]["properties"] + props = mock_client.capture_ai.call_args[1]["properties"] assert props["$ai_input_tokens"] == 100 assert props["$ai_cache_read_input_tokens"] == 20 assert props["$ai_cache_creation_input_tokens"] == 50