@@ -122,26 +122,14 @@ def test_gateway_service_client_from_service_account_info(client_class):
122
122
assert client .transport ._host == "connectgateway.googleapis.com:443"
123
123
124
124
125
- @pytest .mark .parametrize (
126
- "client_class" , [GatewayServiceClient , GatewayServiceAsyncClient ,]
127
- )
128
- def test_gateway_service_client_service_account_always_use_jwt (client_class ):
129
- with mock .patch .object (
130
- service_account .Credentials , "with_always_use_jwt_access" , create = True
131
- ) as use_jwt :
132
- creds = service_account .Credentials (None , None , None )
133
- client = client_class (credentials = creds )
134
- use_jwt .assert_not_called ()
135
-
136
-
137
125
@pytest .mark .parametrize (
138
126
"transport_class,transport_name" ,
139
127
[
140
128
(transports .GatewayServiceGrpcTransport , "grpc" ),
141
129
(transports .GatewayServiceGrpcAsyncIOTransport , "grpc_asyncio" ),
142
130
],
143
131
)
144
- def test_gateway_service_client_service_account_always_use_jwt_true (
132
+ def test_gateway_service_client_service_account_always_use_jwt (
145
133
transport_class , transport_name
146
134
):
147
135
with mock .patch .object (
@@ -151,6 +139,13 @@ def test_gateway_service_client_service_account_always_use_jwt_true(
151
139
transport = transport_class (credentials = creds , always_use_jwt_access = True )
152
140
use_jwt .assert_called_once_with (True )
153
141
142
+ with mock .patch .object (
143
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
144
+ ) as use_jwt :
145
+ creds = service_account .Credentials (None , None , None )
146
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
147
+ use_jwt .assert_not_called ()
148
+
154
149
155
150
@pytest .mark .parametrize (
156
151
"client_class" , [GatewayServiceClient , GatewayServiceAsyncClient ,]
@@ -231,6 +226,7 @@ def test_gateway_service_client_client_options(
231
226
client_cert_source_for_mtls = None ,
232
227
quota_project_id = None ,
233
228
client_info = transports .base .DEFAULT_CLIENT_INFO ,
229
+ always_use_jwt_access = True ,
234
230
)
235
231
236
232
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -247,6 +243,7 @@ def test_gateway_service_client_client_options(
247
243
client_cert_source_for_mtls = None ,
248
244
quota_project_id = None ,
249
245
client_info = transports .base .DEFAULT_CLIENT_INFO ,
246
+ always_use_jwt_access = True ,
250
247
)
251
248
252
249
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -263,6 +260,7 @@ def test_gateway_service_client_client_options(
263
260
client_cert_source_for_mtls = None ,
264
261
quota_project_id = None ,
265
262
client_info = transports .base .DEFAULT_CLIENT_INFO ,
263
+ always_use_jwt_access = True ,
266
264
)
267
265
268
266
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -291,6 +289,7 @@ def test_gateway_service_client_client_options(
291
289
client_cert_source_for_mtls = None ,
292
290
quota_project_id = "octopus" ,
293
291
client_info = transports .base .DEFAULT_CLIENT_INFO ,
292
+ always_use_jwt_access = True ,
294
293
)
295
294
296
295
@@ -357,6 +356,7 @@ def test_gateway_service_client_mtls_env_auto(
357
356
client_cert_source_for_mtls = expected_client_cert_source ,
358
357
quota_project_id = None ,
359
358
client_info = transports .base .DEFAULT_CLIENT_INFO ,
359
+ always_use_jwt_access = True ,
360
360
)
361
361
362
362
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -390,6 +390,7 @@ def test_gateway_service_client_mtls_env_auto(
390
390
client_cert_source_for_mtls = expected_client_cert_source ,
391
391
quota_project_id = None ,
392
392
client_info = transports .base .DEFAULT_CLIENT_INFO ,
393
+ always_use_jwt_access = True ,
393
394
)
394
395
395
396
# Check the case client_cert_source and ADC client cert are not provided.
@@ -411,6 +412,7 @@ def test_gateway_service_client_mtls_env_auto(
411
412
client_cert_source_for_mtls = None ,
412
413
quota_project_id = None ,
413
414
client_info = transports .base .DEFAULT_CLIENT_INFO ,
415
+ always_use_jwt_access = True ,
414
416
)
415
417
416
418
@@ -441,6 +443,7 @@ def test_gateway_service_client_client_options_scopes(
441
443
client_cert_source_for_mtls = None ,
442
444
quota_project_id = None ,
443
445
client_info = transports .base .DEFAULT_CLIENT_INFO ,
446
+ always_use_jwt_access = True ,
444
447
)
445
448
446
449
@@ -471,6 +474,7 @@ def test_gateway_service_client_client_options_credentials_file(
471
474
client_cert_source_for_mtls = None ,
472
475
quota_project_id = None ,
473
476
client_info = transports .base .DEFAULT_CLIENT_INFO ,
477
+ always_use_jwt_access = True ,
474
478
)
475
479
476
480
@@ -490,6 +494,7 @@ def test_gateway_service_client_client_options_from_dict():
490
494
client_cert_source_for_mtls = None ,
491
495
quota_project_id = None ,
492
496
client_info = transports .base .DEFAULT_CLIENT_INFO ,
497
+ always_use_jwt_access = True ,
493
498
)
494
499
495
500
0 commit comments