@@ -269,30 +269,28 @@ def test_exists_hit_w_user_project_w_timeout_w_retry(self):
269269 retry = retry ,
270270 )
271271
272- def test_reload_miss_no_project_set (self ):
272+ def test_reload_miss_w_defaults (self ):
273273 from google .cloud .exceptions import NotFound
274274
275275 access_id = "ACCESS-ID"
276- connection = mock .Mock (spec = ["api_request" ])
277- connection .api_request .side_effect = NotFound ("testing" )
278- client = _Client (connection )
276+ project = "PROJECT"
277+ client = mock .Mock (spec = ["_get_path" , "project" ])
278+ client ._get_path .side_effect = NotFound ("testing" )
279+ client .project = project
279280 metadata = self ._make_one (client )
280281 metadata ._properties ["accessId" ] = access_id
281282
282283 with self .assertRaises (NotFound ):
283- metadata .reload (timeout = 42 )
284+ metadata .reload ()
284285
285- expected_path = "/projects/{}/hmacKeys/{}" .format (
286- client .DEFAULT_PROJECT , access_id
286+ expected_path = "/projects/{}/hmacKeys/{}" .format (project , access_id )
287+ expected_query_params = {}
288+ client ._get_path .assert_called_once_with (
289+ expected_path ,
290+ query_params = expected_query_params ,
291+ timeout = self ._get_default_timeout (),
292+ retry = DEFAULT_RETRY ,
287293 )
288- expected_kwargs = {
289- "method" : "GET" ,
290- "path" : expected_path ,
291- "query_params" : {},
292- "timeout" : 42 ,
293- "retry" : DEFAULT_RETRY ,
294- }
295- connection .api_request .assert_called_once_with (** expected_kwargs )
296294
297295 def test_reload_hit_w_project_set (self ):
298296 project = "PROJECT-ID"
@@ -304,26 +302,26 @@ def test_reload_hit_w_project_set(self):
304302 "accessId" : access_id ,
305303 "serviceAccountEmail" : email ,
306304 }
307- connection = mock .Mock (spec = ["api_request" ])
308- connection .api_request .return_value = resource
309- client = _Client (connection )
305+ timeout = 42
306+ retry = mock .Mock (spec = [])
307+ client = mock .Mock (spec = ["_get_path" ])
308+ client ._get_path .return_value = resource
310309 metadata = self ._make_one (client , user_project = user_project )
311310 metadata ._properties ["accessId" ] = access_id
312311 metadata ._properties ["projectId" ] = project
313312
314- metadata .reload ()
313+ metadata .reload (timeout = timeout , retry = retry )
315314
316315 self .assertEqual (metadata ._properties , resource )
317316
318317 expected_path = "/projects/{}/hmacKeys/{}" .format (project , access_id )
319- expected_kwargs = {
320- "method" : "GET" ,
321- "path" : expected_path ,
322- "query_params" : {"userProject" : user_project },
323- "timeout" : self ._get_default_timeout (),
324- "retry" : DEFAULT_RETRY ,
325- }
326- connection .api_request .assert_called_once_with (** expected_kwargs )
318+ expected_query_params = {"userProject" : user_project }
319+ client ._get_path .assert_called_once_with (
320+ expected_path ,
321+ query_params = expected_query_params ,
322+ timeout = timeout ,
323+ retry = retry ,
324+ )
327325
328326 def test_update_miss_no_project_set (self ):
329327 from google .cloud .exceptions import NotFound
0 commit comments