Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions tests/unittests/sessions/test_vertex_ai_session_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,12 +620,16 @@ def mock_vertex_ai_session_service(
def mock_api_client_instance():
"""Creates a mock API client instance for testing."""
api_client = MockAsyncClient()
# Deep-copy the session payloads like the events below: the mock client
# mutates `session_dict[...]['update_time']` when an event is appended, and
# sharing the module-level dicts across tests would leak that update into
# later tests that compare against `MOCK_SESSION`.
api_client.session_dict = {
'1': MOCK_SESSION_JSON_1,
'2': MOCK_SESSION_JSON_2,
'3': MOCK_SESSION_JSON_3,
'page1': MOCK_SESSION_JSON_PAGE1,
'page2': MOCK_SESSION_JSON_PAGE2,
'1': copy.deepcopy(MOCK_SESSION_JSON_1),
'2': copy.deepcopy(MOCK_SESSION_JSON_2),
'3': copy.deepcopy(MOCK_SESSION_JSON_3),
'page1': copy.deepcopy(MOCK_SESSION_JSON_PAGE1),
'page2': copy.deepcopy(MOCK_SESSION_JSON_PAGE2),
}
api_client.event_dict = {
'1': (copy.deepcopy(MOCK_EVENT_JSON), None),
Expand Down