@@ -44,6 +44,12 @@ def test_w_env_var(self):
4444
4545
4646class Test_PropertyMixin (unittest .TestCase ):
47+ @staticmethod
48+ def _get_default_timeout ():
49+ from google .cloud .storage .constants import _DEFAULT_TIMEOUT
50+
51+ return _DEFAULT_TIMEOUT
52+
4753 @staticmethod
4854 def _get_target_class ():
4955 from google .cloud .storage ._helpers import _PropertyMixin
@@ -103,7 +109,7 @@ def test_reload(self):
103109 # Make sure changes is not a set instance before calling reload
104110 # (which will clear / replace it with an empty set), checked below.
105111 derived ._changes = object ()
106- derived .reload (client = client )
112+ derived .reload (client = client , timeout = 42 )
107113 self .assertEqual (derived ._properties , {"foo" : "Foo" })
108114 kw = connection ._requested
109115 self .assertEqual (len (kw ), 1 )
@@ -115,6 +121,7 @@ def test_reload(self):
115121 "query_params" : {"projection" : "noAcl" },
116122 "headers" : {},
117123 "_target_object" : derived ,
124+ "timeout" : 42 ,
118125 },
119126 )
120127 self .assertEqual (derived ._changes , set ())
@@ -139,6 +146,7 @@ def test_reload_w_user_project(self):
139146 "query_params" : {"projection" : "noAcl" , "userProject" : user_project },
140147 "headers" : {},
141148 "_target_object" : derived ,
149+ "timeout" : self ._get_default_timeout (),
142150 },
143151 )
144152 self .assertEqual (derived ._changes , set ())
@@ -164,7 +172,7 @@ def test_patch(self):
164172 BAZ = object ()
165173 derived ._properties = {"bar" : BAR , "baz" : BAZ }
166174 derived ._changes = set (["bar" ]) # Ignore baz.
167- derived .patch (client = client )
175+ derived .patch (client = client , timeout = 42 )
168176 self .assertEqual (derived ._properties , {"foo" : "Foo" })
169177 kw = connection ._requested
170178 self .assertEqual (len (kw ), 1 )
@@ -177,6 +185,7 @@ def test_patch(self):
177185 # Since changes does not include `baz`, we don't see it sent.
178186 "data" : {"bar" : BAR },
179187 "_target_object" : derived ,
188+ "timeout" : 42 ,
180189 },
181190 )
182191 # Make sure changes get reset by patch().
@@ -205,6 +214,7 @@ def test_patch_w_user_project(self):
205214 # Since changes does not include `baz`, we don't see it sent.
206215 "data" : {"bar" : BAR },
207216 "_target_object" : derived ,
217+ "timeout" : self ._get_default_timeout (),
208218 },
209219 )
210220 # Make sure changes get reset by patch().
@@ -219,14 +229,15 @@ def test_update(self):
219229 BAZ = object ()
220230 derived ._properties = {"bar" : BAR , "baz" : BAZ }
221231 derived ._changes = set (["bar" ]) # Update sends 'baz' anyway.
222- derived .update (client = client )
232+ derived .update (client = client , timeout = 42 )
223233 self .assertEqual (derived ._properties , {"foo" : "Foo" })
224234 kw = connection ._requested
225235 self .assertEqual (len (kw ), 1 )
226236 self .assertEqual (kw [0 ]["method" ], "PUT" )
227237 self .assertEqual (kw [0 ]["path" ], "/path" )
228238 self .assertEqual (kw [0 ]["query_params" ], {"projection" : "full" })
229239 self .assertEqual (kw [0 ]["data" ], {"bar" : BAR , "baz" : BAZ })
240+ self .assertEqual (kw [0 ]["timeout" ], 42 )
230241 # Make sure changes get reset by patch().
231242 self .assertEqual (derived ._changes , set ())
232243
@@ -250,6 +261,7 @@ def test_update_w_user_project(self):
250261 kw [0 ]["query_params" ], {"projection" : "full" , "userProject" : user_project }
251262 )
252263 self .assertEqual (kw [0 ]["data" ], {"bar" : BAR , "baz" : BAZ })
264+ self .assertEqual (kw [0 ]["timeout" ], self ._get_default_timeout ())
253265 # Make sure changes get reset by patch().
254266 self .assertEqual (derived ._changes , set ())
255267
0 commit comments