mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-01 07:03:02 +00:00
test(proxy): mark the remaining new websocket test variables Final
Builds the logging mocks with model_call_details in the constructor instead of setting it afterwards.
This commit is contained in:
parent
1d70354c06
commit
06af85fbe0
3 changed files with 5 additions and 7 deletions
|
|
@ -23,8 +23,7 @@ SESSION_START: Final = datetime(2026, 1, 1, 12, 0, 0)
|
|||
|
||||
|
||||
def _logging_obj() -> MagicMock:
|
||||
logging_obj = MagicMock()
|
||||
logging_obj.model_call_details = {}
|
||||
logging_obj: Final = MagicMock(model_call_details={})
|
||||
return logging_obj
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8056,7 +8056,7 @@ async def test_websocket_passthrough_still_bills_a_session_the_client_walked_out
|
|||
REALTIME_RESPONSE_DONE,
|
||||
json.dumps({"type": "response.output_text.delta", "delta": "too late"}),
|
||||
)
|
||||
websocket = _client_websocket(_pending_receive)
|
||||
websocket: Final = _client_websocket(_pending_receive)
|
||||
websocket.send_text = AsyncMock(side_effect=[None, None, WebSocketDisconnect(code=1006)])
|
||||
|
||||
with (
|
||||
|
|
@ -8136,7 +8136,7 @@ def _turn_taking_client(
|
|||
frame: Final = next(script, None)
|
||||
return {"type": "websocket.disconnect"} if frame is None else _received_frame(frame)
|
||||
|
||||
websocket = _client_websocket(receive)
|
||||
websocket: Final = _client_websocket(receive)
|
||||
|
||||
async def send_text(text: str) -> None:
|
||||
if websocket.application_state == WebSocketState.DISCONNECTED:
|
||||
|
|
@ -8529,7 +8529,7 @@ async def test_websocket_passthrough_bills_the_turn_a_client_walked_out_of_once_
|
|||
|
||||
client_left: Final = asyncio.Event()
|
||||
send_failed: Final = asyncio.Event()
|
||||
client = _turn_taking_client(
|
||||
client: Final = _turn_taking_client(
|
||||
[json.dumps({"type": "response.create", "model": "gpt-5.4"})], answered_by='"response.created"'
|
||||
)
|
||||
receive: Final = client.receive
|
||||
|
|
|
|||
|
|
@ -668,8 +668,7 @@ REALTIME_FRAMES: Final = [
|
|||
|
||||
|
||||
def _normalize(url_route: str, response_body: dict[str, object] | list[dict[str, object]]) -> dict:
|
||||
logging_obj = MagicMock()
|
||||
logging_obj.model_call_details = {}
|
||||
logging_obj: Final = MagicMock(model_call_details={})
|
||||
return PassThroughEndpointLogging().normalize_llm_passthrough_logging_payload(
|
||||
httpx_response=MagicMock(spec=httpx.Response),
|
||||
response_body=response_body,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue