Skip to content

Commit c3a01a4

Browse files
author
Test User
committed
test(resumable_media): supply explicit body parameters in responses mock setup
1 parent a9d6c5f commit c3a01a4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/google-api-core/tests/unit/resumable_media/test_requests_upload.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def test_happy_path_upload():
5555
initial_url,
5656
status=200,
5757
headers={"X-Goog-Upload-Status": "active", "X-Goog-Upload-URL": session_url},
58+
body="",
5859
)
5960

6061
# Mock Upload & Finalize
@@ -102,10 +103,11 @@ def test_upload_with_retry():
102103
initial_url,
103104
status=200,
104105
headers={"X-Goog-Upload-Status": "active", "X-Goog-Upload-URL": session_url},
106+
body="",
105107
)
106108

107109
# Mock 503 then 200 for the same request
108-
responses.add(responses.POST, session_url, status=503)
110+
responses.add(responses.POST, session_url, status=503, body="")
109111
responses.add(
110112
responses.POST,
111113
session_url,
@@ -142,6 +144,7 @@ def test_upload_with_recovery_query():
142144
initial_url,
143145
status=200,
144146
headers={"X-Goog-Upload-Status": "active", "X-Goog-Upload-URL": session_url},
147+
body="",
145148
)
146149

147150
# Fatal error
@@ -150,6 +153,7 @@ def test_upload_with_recovery_query():
150153
session_url,
151154
status=400,
152155
headers={},
156+
body="",
153157
)
154158

155159
# Recovery Query
@@ -158,6 +162,7 @@ def test_upload_with_recovery_query():
158162
session_url,
159163
status=200,
160164
headers={"X-Goog-Upload-Status": "active", "X-Goog-Upload-Size-Received": "0"},
165+
body="",
161166
)
162167

163168
# Final Upload
@@ -200,6 +205,7 @@ def test_interruption_and_query_recovery_mid_stream():
200205
initial_url,
201206
status=200,
202207
headers={"X-Goog-Upload-Status": "active", "X-Goog-Upload-URL": session_url},
208+
body="",
203209
)
204210

205211
# 1. First chunk (0-4) succeeds. Note: The chunk boundary is 5
@@ -208,13 +214,15 @@ def test_interruption_and_query_recovery_mid_stream():
208214
session_url,
209215
status=200,
210216
headers={"X-Goog-Upload-Status": "active"},
217+
body="",
211218
)
212219

213220
# 2. Second chunk (5-9) fails fatally
214221
responses.add(
215222
responses.POST,
216223
session_url,
217224
status=400,
225+
body="",
218226
)
219227

220228
# 3. Query reports 5 bytes received
@@ -223,6 +231,7 @@ def test_interruption_and_query_recovery_mid_stream():
223231
session_url,
224232
status=200,
225233
headers={"X-Goog-Upload-Status": "active", "X-Goog-Upload-Size-Received": "5"},
234+
body="",
226235
)
227236

228237
# 4. Resume from 5 succeeds
@@ -263,6 +272,7 @@ def test_logging_success_path(caplog):
263272
initial_url,
264273
status=200,
265274
headers={"X-Goog-Upload-Status": "active", "X-Goog-Upload-URL": session_url},
275+
body="",
266276
)
267277
responses.add(
268278
responses.POST,

0 commit comments

Comments
 (0)