Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test(proxy): set status_code on chunk_processor response mocks

Shivam Rawatcbfba17b1c89
diff --git a/tests/pass_through_unit_tests/test_unit_test_streaming.py b/tests/pass_through_unit_tests/test_unit_test_streaming.py
index 63965320f2b..ed98b720b37 100644
--- a/tests/pass_through_unit_tests/test_unit_test_streaming.py
+++ b/tests/pass_through_unit_tests/test_unit_test_streaming.py
@@ -50,6 +50,7 @@ async def test_chunk_processor_yields_raw_bytes(endpoint_type, url_route):
"""
# Mock inputs
response = AsyncMock(spec=httpx.Response)
+ response.status_code = 200
raw_chunks = [
b'{"id": "1", "content": "Hello"}',
b'{"id": "2", "content": "World"}',
diff --git a/tests/pass_through_unit_tests/test_vertex_ai_anthropic_streaming_cost_injection.py b/tests/pass_through_unit_tests/test_vertex_ai_anthropic_streaming_cost_injection.py
index 3e94eb3a4f5..b42f1fe6f0a 100644
--- a/tests/pass_through_unit_tests/test_vertex_ai_anthropic_streaming_cost_injection.py
+++ b/tests/pass_through_unit_tests/test_vertex_ai_anthropic_streaming_cost_injection.py
@@ -39,6 +39,7 @@ async def test_vertex_ai_anthropic_streaming_cost_injection_enabled():
try:
# Mock response with Anthropic SSE format chunks
response = AsyncMock(spec=httpx.Response)
+ response.status_code = 200
# Create chunks with message_delta event containing usage
chunks_with_usage = [
@@ -120,6 +121,7 @@ async def test_vertex_ai_anthropic_streaming_cost_injection_disabled():
try:
# Mock response with Anthropic SSE format chunks
response = AsyncMock(spec=httpx.Response)
+ response.status_code = 200
chunks_with_usage = [
b'data: {"type": "message_delta", "usage": {"input_tokens": 10, "output_tokens": 5}}\n\n',
@@ -178,6 +180,7 @@ async def test_vertex_ai_anthropic_streaming_cost_injection_no_usage_chunk():
try:
response = AsyncMock(spec=httpx.Response)
+ response.status_code = 200
# Chunks without usage (should not be modified)
chunks_without_usage = [
@@ -233,6 +236,7 @@ async def test_vertex_ai_anthropic_streaming_model_extraction():
try:
response = AsyncMock(spec=httpx.Response)
+ response.status_code = 200
chunks = [
b'data: {"type": "message_delta", "usage": {"input_tokens": 10, "output_tokens": 5}}\n\n',