chore: format proxy route tests with ruff

This commit is contained in:
Kayzo 2026-04-21 19:38:32 +00:00
parent fbbde51db1
commit 1961cebd00
3 changed files with 13 additions and 17 deletions

View file

@ -118,9 +118,7 @@ def test_codex_responses_subpath_aliases_delegate_to_passthrough():
),
],
)
def test_codex_responses_subpath_passthrough_derives_chatgpt_routing_from_jwt(
path, expected_url
):
def test_codex_responses_subpath_passthrough_derives_chatgpt_routing_from_jwt(path, expected_url):
class FakeAsyncClient:
def __init__(self) -> None:
self.calls: list[tuple[str, str, dict[str, str]]] = []

View file

@ -98,9 +98,7 @@ def test_cloudcode_route_uses_cloudcode_api_override(monkeypatch):
monkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)
with TestClient(
create_app(
ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test/v1")
)
create_app(ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test/v1"))
) as client:
response = client.post(
"/v1/v1internal:streamGenerateContent",
@ -150,9 +148,7 @@ def test_antigravity_route_does_not_cross_route_to_cloudcode_override(monkeypatc
monkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)
with TestClient(
create_app(
ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test")
)
create_app(ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test"))
) as client:
response = client.post(
"/v1internal:streamGenerateContent",
@ -175,9 +171,7 @@ def test_cloudcode_override_does_not_leak_between_app_instances(monkeypatch):
monkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)
with TestClient(
create_app(
ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test")
)
create_app(ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test"))
) as client:
first = client.post(
"/v1internal:streamGenerateContent",
@ -193,6 +187,12 @@ def test_cloudcode_override_does_not_leak_between_app_instances(monkeypatch):
)
assert first.status_code == 200
assert first.json()["url"] == "https://cloudcode-proxy.test/v1internal:streamGenerateContent?alt=sse"
assert (
first.json()["url"]
== "https://cloudcode-proxy.test/v1internal:streamGenerateContent?alt=sse"
)
assert second.status_code == 200
assert second.json()["url"] == "https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse"
assert (
second.json()["url"]
== "https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse"
)

View file

@ -220,9 +220,7 @@ class TestStreamingRatelimitHeaderForwarding:
"content-length": "42",
}
)
mock_response.aread = AsyncMock(
return_value=b'{"error":{"message":"capacity exhausted"}}'
)
mock_response.aread = AsyncMock(return_value=b'{"error":{"message":"capacity exhausted"}}')
mock_response.aclose = AsyncMock()
mock_request = MagicMock()