mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
test(responses): use httpx.Response and assert callback fired in retrieve-path tests
Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>
This commit is contained in:
parent
19d7f66ca5
commit
596d9aaf65
1 changed files with 5 additions and 13 deletions
|
|
@ -3,12 +3,12 @@ Integration tests for responses API background cost tracking
|
|||
"""
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
from datetime import datetime
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, MagicMock, Mock, patch
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
import litellm
|
||||
|
|
@ -670,18 +670,8 @@ def _fake_get_response(status, with_usage):
|
|||
),
|
||||
}
|
||||
|
||||
class _Resp:
|
||||
status_code = 200
|
||||
headers = {}
|
||||
text = json.dumps(payload)
|
||||
|
||||
def json(self):
|
||||
return payload
|
||||
|
||||
def raise_for_status(self):
|
||||
return None
|
||||
|
||||
return _Resp()
|
||||
request = httpx.Request("GET", "https://api.openai.com/v1/responses/resp_finalize_test")
|
||||
return httpx.Response(status_code=200, json=payload, request=request)
|
||||
|
||||
|
||||
async def _capture_aget_responses(status, with_usage):
|
||||
|
|
@ -704,6 +694,8 @@ async def _capture_aget_responses(status, with_usage):
|
|||
await asyncio.sleep(0.1)
|
||||
finally:
|
||||
litellm.callbacks = original_callbacks
|
||||
|
||||
assert capture.events, "success logging callback never fired for the retrieved response"
|
||||
return capture.events
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue