@@ -146,6 +146,12 @@ class TestJSONConnection(unittest.TestCase):
146
146
JSON_HEADERS = {"content-type" : "application/json" }
147
147
EMPTY_JSON_RESPONSE = make_response (content = b"{}" , headers = JSON_HEADERS )
148
148
149
+ @staticmethod
150
+ def _get_default_timeout ():
151
+ from google .cloud ._http import _DEFAULT_TIMEOUT
152
+
153
+ return _DEFAULT_TIMEOUT
154
+
149
155
@staticmethod
150
156
def _get_target_class ():
151
157
from google .cloud ._http import JSONConnection
@@ -217,7 +223,11 @@ def test__make_request_no_data_no_content_type_no_headers(self):
217
223
CLIENT_INFO_HEADER : conn .user_agent ,
218
224
}
219
225
http .request .assert_called_once_with (
220
- method = "GET" , url = url , headers = expected_headers , data = None , timeout = None
226
+ method = "GET" ,
227
+ url = url ,
228
+ headers = expected_headers ,
229
+ data = None ,
230
+ timeout = self ._get_default_timeout (),
221
231
)
222
232
223
233
def test__make_request_w_data_no_extra_headers (self ):
@@ -238,7 +248,11 @@ def test__make_request_w_data_no_extra_headers(self):
238
248
CLIENT_INFO_HEADER : conn .user_agent ,
239
249
}
240
250
http .request .assert_called_once_with (
241
- method = "GET" , url = url , headers = expected_headers , data = data , timeout = None
251
+ method = "GET" ,
252
+ url = url ,
253
+ headers = expected_headers ,
254
+ data = data ,
255
+ timeout = self ._get_default_timeout (),
242
256
)
243
257
244
258
def test__make_request_w_extra_headers (self ):
@@ -258,7 +272,11 @@ def test__make_request_w_extra_headers(self):
258
272
CLIENT_INFO_HEADER : conn .user_agent ,
259
273
}
260
274
http .request .assert_called_once_with (
261
- method = "GET" , url = url , headers = expected_headers , data = None , timeout = None
275
+ method = "GET" ,
276
+ url = url ,
277
+ headers = expected_headers ,
278
+ data = None ,
279
+ timeout = self ._get_default_timeout (),
262
280
)
263
281
264
282
def test__make_request_w_timeout (self ):
@@ -309,7 +327,7 @@ def test_api_request_defaults(self):
309
327
url = expected_url ,
310
328
headers = expected_headers ,
311
329
data = None ,
312
- timeout = None ,
330
+ timeout = self . _get_default_timeout () ,
313
331
)
314
332
315
333
def test_api_request_w_non_json_response (self ):
@@ -352,7 +370,7 @@ def test_api_request_w_query_params(self):
352
370
url = mock .ANY ,
353
371
headers = expected_headers ,
354
372
data = None ,
355
- timeout = None ,
373
+ timeout = self . _get_default_timeout () ,
356
374
)
357
375
358
376
url = http .request .call_args [1 ]["url" ]
@@ -386,7 +404,7 @@ def test_api_request_w_headers(self):
386
404
url = mock .ANY ,
387
405
headers = expected_headers ,
388
406
data = None ,
389
- timeout = None ,
407
+ timeout = self . _get_default_timeout () ,
390
408
)
391
409
392
410
def test_api_request_w_extra_headers (self ):
@@ -416,7 +434,7 @@ def test_api_request_w_extra_headers(self):
416
434
url = mock .ANY ,
417
435
headers = expected_headers ,
418
436
data = None ,
419
- timeout = None ,
437
+ timeout = self . _get_default_timeout () ,
420
438
)
421
439
422
440
def test_api_request_w_data (self ):
@@ -443,7 +461,7 @@ def test_api_request_w_data(self):
443
461
url = mock .ANY ,
444
462
headers = expected_headers ,
445
463
data = expected_data ,
446
- timeout = None ,
464
+ timeout = self . _get_default_timeout () ,
447
465
)
448
466
449
467
def test_api_request_w_timeout (self ):
0 commit comments