@@ -125,26 +125,14 @@ def test_vpc_access_service_client_from_service_account_info(client_class):
125125 assert client .transport ._host == "vpcaccess.googleapis.com:443"
126126
127127
128- @pytest .mark .parametrize (
129- "client_class" , [VpcAccessServiceClient , VpcAccessServiceAsyncClient ,]
130- )
131- def test_vpc_access_service_client_service_account_always_use_jwt (client_class ):
132- with mock .patch .object (
133- service_account .Credentials , "with_always_use_jwt_access" , create = True
134- ) as use_jwt :
135- creds = service_account .Credentials (None , None , None )
136- client = client_class (credentials = creds )
137- use_jwt .assert_not_called ()
138-
139-
140128@pytest .mark .parametrize (
141129 "transport_class,transport_name" ,
142130 [
143131 (transports .VpcAccessServiceGrpcTransport , "grpc" ),
144132 (transports .VpcAccessServiceGrpcAsyncIOTransport , "grpc_asyncio" ),
145133 ],
146134)
147- def test_vpc_access_service_client_service_account_always_use_jwt_true (
135+ def test_vpc_access_service_client_service_account_always_use_jwt (
148136 transport_class , transport_name
149137):
150138 with mock .patch .object (
@@ -154,6 +142,13 @@ def test_vpc_access_service_client_service_account_always_use_jwt_true(
154142 transport = transport_class (credentials = creds , always_use_jwt_access = True )
155143 use_jwt .assert_called_once_with (True )
156144
145+ with mock .patch .object (
146+ service_account .Credentials , "with_always_use_jwt_access" , create = True
147+ ) as use_jwt :
148+ creds = service_account .Credentials (None , None , None )
149+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
150+ use_jwt .assert_not_called ()
151+
157152
158153@pytest .mark .parametrize (
159154 "client_class" , [VpcAccessServiceClient , VpcAccessServiceAsyncClient ,]
@@ -234,6 +229,7 @@ def test_vpc_access_service_client_client_options(
234229 client_cert_source_for_mtls = None ,
235230 quota_project_id = None ,
236231 client_info = transports .base .DEFAULT_CLIENT_INFO ,
232+ always_use_jwt_access = True ,
237233 )
238234
239235 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -250,6 +246,7 @@ def test_vpc_access_service_client_client_options(
250246 client_cert_source_for_mtls = None ,
251247 quota_project_id = None ,
252248 client_info = transports .base .DEFAULT_CLIENT_INFO ,
249+ always_use_jwt_access = True ,
253250 )
254251
255252 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -266,6 +263,7 @@ def test_vpc_access_service_client_client_options(
266263 client_cert_source_for_mtls = None ,
267264 quota_project_id = None ,
268265 client_info = transports .base .DEFAULT_CLIENT_INFO ,
266+ always_use_jwt_access = True ,
269267 )
270268
271269 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -294,6 +292,7 @@ def test_vpc_access_service_client_client_options(
294292 client_cert_source_for_mtls = None ,
295293 quota_project_id = "octopus" ,
296294 client_info = transports .base .DEFAULT_CLIENT_INFO ,
295+ always_use_jwt_access = True ,
297296 )
298297
299298
@@ -370,6 +369,7 @@ def test_vpc_access_service_client_mtls_env_auto(
370369 client_cert_source_for_mtls = expected_client_cert_source ,
371370 quota_project_id = None ,
372371 client_info = transports .base .DEFAULT_CLIENT_INFO ,
372+ always_use_jwt_access = True ,
373373 )
374374
375375 # Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -403,6 +403,7 @@ def test_vpc_access_service_client_mtls_env_auto(
403403 client_cert_source_for_mtls = expected_client_cert_source ,
404404 quota_project_id = None ,
405405 client_info = transports .base .DEFAULT_CLIENT_INFO ,
406+ always_use_jwt_access = True ,
406407 )
407408
408409 # Check the case client_cert_source and ADC client cert are not provided.
@@ -424,6 +425,7 @@ def test_vpc_access_service_client_mtls_env_auto(
424425 client_cert_source_for_mtls = None ,
425426 quota_project_id = None ,
426427 client_info = transports .base .DEFAULT_CLIENT_INFO ,
428+ always_use_jwt_access = True ,
427429 )
428430
429431
@@ -454,6 +456,7 @@ def test_vpc_access_service_client_client_options_scopes(
454456 client_cert_source_for_mtls = None ,
455457 quota_project_id = None ,
456458 client_info = transports .base .DEFAULT_CLIENT_INFO ,
459+ always_use_jwt_access = True ,
457460 )
458461
459462
@@ -484,6 +487,7 @@ def test_vpc_access_service_client_client_options_credentials_file(
484487 client_cert_source_for_mtls = None ,
485488 quota_project_id = None ,
486489 client_info = transports .base .DEFAULT_CLIENT_INFO ,
490+ always_use_jwt_access = True ,
487491 )
488492
489493
@@ -503,6 +507,7 @@ def test_vpc_access_service_client_client_options_from_dict():
503507 client_cert_source_for_mtls = None ,
504508 quota_project_id = None ,
505509 client_info = transports .base .DEFAULT_CLIENT_INFO ,
510+ always_use_jwt_access = True ,
506511 )
507512
508513
0 commit comments