JerrettDavis Copilot commited on
Commit
46de0de
·
1 Parent(s): 12eee07

style: align proxy tests with current ruff formatter

Browse files

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

tests/test_proxy_codex_route_aliases.py CHANGED
@@ -118,9 +118,7 @@ def test_codex_responses_subpath_aliases_delegate_to_passthrough():
118
  ),
119
  ],
120
  )
121
- def test_codex_responses_subpath_passthrough_derives_chatgpt_routing_from_jwt(
122
- path, expected_url
123
- ):
124
  class FakeAsyncClient:
125
  def __init__(self) -> None:
126
  self.calls: list[tuple[str, str, dict[str, str]]] = []
 
118
  ),
119
  ],
120
  )
121
+ def test_codex_responses_subpath_passthrough_derives_chatgpt_routing_from_jwt(path, expected_url):
 
 
122
  class FakeAsyncClient:
123
  def __init__(self) -> None:
124
  self.calls: list[tuple[str, str, dict[str, str]]] = []
tests/test_proxy_google_cloudcode_route_aliases.py CHANGED
@@ -98,9 +98,7 @@ def test_cloudcode_route_uses_cloudcode_api_override(monkeypatch):
98
  monkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)
99
 
100
  with TestClient(
101
- create_app(
102
- ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test/v1")
103
- )
104
  ) as client:
105
  response = client.post(
106
  "/v1/v1internal:streamGenerateContent",
@@ -150,9 +148,7 @@ def test_antigravity_route_does_not_cross_route_to_cloudcode_override(monkeypatc
150
  monkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)
151
 
152
  with TestClient(
153
- create_app(
154
- ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test")
155
- )
156
  ) as client:
157
  response = client.post(
158
  "/v1internal:streamGenerateContent",
@@ -175,9 +171,7 @@ def test_cloudcode_override_does_not_leak_between_app_instances(monkeypatch):
175
  monkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)
176
 
177
  with TestClient(
178
- create_app(
179
- ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test")
180
- )
181
  ) as client:
182
  first = client.post(
183
  "/v1internal:streamGenerateContent",
@@ -193,6 +187,12 @@ def test_cloudcode_override_does_not_leak_between_app_instances(monkeypatch):
193
  )
194
 
195
  assert first.status_code == 200
196
- assert first.json()["url"] == "https://cloudcode-proxy.test/v1internal:streamGenerateContent?alt=sse"
 
 
 
197
  assert second.status_code == 200
198
- assert second.json()["url"] == "https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse"
 
 
 
 
98
  monkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)
99
 
100
  with TestClient(
101
+ create_app(ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test/v1"))
 
 
102
  ) as client:
103
  response = client.post(
104
  "/v1/v1internal:streamGenerateContent",
 
148
  monkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)
149
 
150
  with TestClient(
151
+ create_app(ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test"))
 
 
152
  ) as client:
153
  response = client.post(
154
  "/v1internal:streamGenerateContent",
 
171
  monkeypatch.setattr(HeadroomProxy, "_stream_response", fake_stream)
172
 
173
  with TestClient(
174
+ create_app(ProxyConfig(optimize=False, cloudcode_api_url="https://cloudcode-proxy.test"))
 
 
175
  ) as client:
176
  first = client.post(
177
  "/v1internal:streamGenerateContent",
 
187
  )
188
 
189
  assert first.status_code == 200
190
+ assert (
191
+ first.json()["url"]
192
+ == "https://cloudcode-proxy.test/v1internal:streamGenerateContent?alt=sse"
193
+ )
194
  assert second.status_code == 200
195
+ assert (
196
+ second.json()["url"]
197
+ == "https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse"
198
+ )
tests/test_proxy_streaming_ratelimit_headers.py CHANGED
@@ -220,9 +220,7 @@ class TestStreamingRatelimitHeaderForwarding:
220
  "content-length": "42",
221
  }
222
  )
223
- mock_response.aread = AsyncMock(
224
- return_value=b'{"error":{"message":"capacity exhausted"}}'
225
- )
226
  mock_response.aclose = AsyncMock()
227
 
228
  mock_request = MagicMock()
 
220
  "content-length": "42",
221
  }
222
  )
223
+ mock_response.aread = AsyncMock(return_value=b'{"error":{"message":"capacity exhausted"}}')
 
 
224
  mock_response.aclose = AsyncMock()
225
 
226
  mock_request = MagicMock()