@@ -348,7 +348,12 @@ def test_ctor_mtls(self):
348348
349349 def test_ctor_w_custom_endpoint_use_auth (self ):
350350 custom_endpoint = "storage-example.p.googleapis.com"
351- client = self ._make_one (client_options = {"api_endpoint" : custom_endpoint })
351+ credentials = _make_credentials ()
352+ client = self ._make_one (
353+ project = "project" ,
354+ credentials = credentials ,
355+ client_options = {"api_endpoint" : custom_endpoint },
356+ )
352357 self .assertEqual (client ._connection .API_BASE_URL , custom_endpoint )
353358 self .assertIsNotNone (client .project )
354359 self .assertIsInstance (client ._connection , Connection )
@@ -357,10 +362,10 @@ def test_ctor_w_custom_endpoint_use_auth(self):
357362
358363 def test_ctor_w_custom_endpoint_bypass_auth (self ):
359364 custom_endpoint = "storage-example.p.googleapis.com"
360- client = self ._make_one (
361- client_options = {"api_endpoint" : custom_endpoint },
362- use_auth_w_custom_endpoint = False ,
363- )
365+ client = self ._make_one (
366+ client_options = {"api_endpoint" : custom_endpoint },
367+ use_auth_w_custom_endpoint = False ,
368+ )
364369 self .assertEqual (client ._connection .API_BASE_URL , custom_endpoint )
365370 self .assertEqual (client .project , None )
366371 self .assertIsInstance (client ._connection , Connection )
@@ -370,9 +375,9 @@ def test_ctor_w_custom_endpoint_w_credentials(self):
370375 PROJECT = "PROJECT"
371376 custom_endpoint = "storage-example.p.googleapis.com"
372377 credentials = _make_credentials (project = PROJECT )
373- client = self ._make_one (
374- credentials = credentials , client_options = {"api_endpoint" : custom_endpoint }
375- )
378+ client = self ._make_one (
379+ credentials = credentials , client_options = {"api_endpoint" : custom_endpoint }
380+ )
376381 self .assertEqual (client ._connection .API_BASE_URL , custom_endpoint )
377382 self .assertEqual (client .project , PROJECT )
378383 self .assertIsInstance (client ._connection , Connection )
@@ -434,8 +439,9 @@ def test_ctor_w_api_endpoint_override(self):
434439 host = "http://localhost:8080"
435440 environ = {_API_ENDPOINT_OVERRIDE_ENV_VAR : host }
436441 project = "my-test-project"
442+ credentials = _make_credentials ()
437443 with mock .patch ("os.environ" , environ ):
438- client = self ._make_one (project = project )
444+ client = self ._make_one (project = project , credentials = credentials )
439445
440446 self .assertEqual (client .project , project )
441447 self .assertEqual (client ._connection .API_BASE_URL , host )
@@ -1475,7 +1481,12 @@ def test_create_bucket_w_environ_project_w_emulator(self):
14751481
14761482 def test_create_bucket_w_custom_endpoint (self ):
14771483 custom_endpoint = "storage-example.p.googleapis.com"
1478- client = self ._make_one (client_options = {"api_endpoint" : custom_endpoint })
1484+ credentials = _make_credentials ()
1485+ client = self ._make_one (
1486+ project = "project" ,
1487+ credentials = credentials ,
1488+ client_options = {"api_endpoint" : custom_endpoint },
1489+ )
14791490 bucket_name = "bucket-name"
14801491 api_response = {"name" : bucket_name }
14811492 client ._post_resource = mock .Mock ()
@@ -1533,14 +1544,18 @@ def test_update_user_agent_when_default_clientinfo_provided(self):
15331544
15341545 client_info = ClientInfo ()
15351546
1536- client = self ._make_one (project = None , client_info = client_info )
1547+ credentials = _make_credentials ()
1548+ client = self ._make_one (
1549+ project = None , credentials = credentials , client_info = client_info
1550+ )
15371551 self .assertGreater (len (client ._connection .user_agent ), 0 )
15381552
15391553 client .update_user_agent ("my-test-agent/1.0" )
15401554 self .assertIn ("my-test-agent/1.0" , client ._connection .user_agent )
15411555
15421556 def test_update_user_agent_when_none_clientinfo_provided (self ):
1543- client = self ._make_one (project = None )
1557+ credentials = _make_credentials ()
1558+ client = self ._make_one (project = None , credentials = credentials )
15441559 client .update_user_agent ("my-test-agent/1.0" )
15451560
15461561 self .assertIn ("my-test-agent/1.0" , client ._connection .user_agent )
@@ -1549,7 +1564,10 @@ def test_update_user_agent_with_existing_user_agent(self):
15491564 from google .cloud ._http import ClientInfo
15501565
15511566 client_info = ClientInfo (user_agent = "existing-agent/2.0" )
1552- client = self ._make_one (project = None , client_info = client_info )
1567+ credentials = _make_credentials ()
1568+ client = self ._make_one (
1569+ project = None , credentials = credentials , client_info = client_info
1570+ )
15531571 client .update_user_agent ("my-test-agent/1.0" )
15541572
15551573 self .assertIn (
@@ -2336,7 +2354,12 @@ def test_list_buckets_w_custom_endpoint(self):
23362354 from google .cloud .storage .client import _item_to_bucket , _buckets_page_start
23372355
23382356 custom_endpoint = "storage-example.p.googleapis.com"
2339- client = self ._make_one (client_options = {"api_endpoint" : custom_endpoint })
2357+ credentials = _make_credentials ()
2358+ client = self ._make_one (
2359+ project = "project" ,
2360+ credentials = credentials ,
2361+ client_options = {"api_endpoint" : custom_endpoint },
2362+ )
23402363 client ._list_resource = mock .Mock (spec = [])
23412364
23422365 iterator = client .list_buckets ()
@@ -3101,7 +3124,8 @@ def test_list_buckets_w_partial_success(self):
31013124 bucket_name = "bucket-name"
31023125 unreachable_bucket = "projects/_/buckets/unreachable-bucket"
31033126
3104- client = self ._make_one (project = PROJECT )
3127+ credentials = _make_credentials ()
3128+ client = self ._make_one (project = PROJECT , credentials = credentials )
31053129
31063130 mock_bucket = mock .Mock ()
31073131 mock_bucket .name = bucket_name
0 commit comments