@@ -128,26 +128,14 @@ def test_container_analysis_client_from_service_account_info(client_class):
128
128
assert client .transport ._host == "containeranalysis.googleapis.com:443"
129
129
130
130
131
- @pytest .mark .parametrize (
132
- "client_class" , [ContainerAnalysisClient , ContainerAnalysisAsyncClient ,]
133
- )
134
- def test_container_analysis_client_service_account_always_use_jwt (client_class ):
135
- with mock .patch .object (
136
- service_account .Credentials , "with_always_use_jwt_access" , create = True
137
- ) as use_jwt :
138
- creds = service_account .Credentials (None , None , None )
139
- client = client_class (credentials = creds )
140
- use_jwt .assert_not_called ()
141
-
142
-
143
131
@pytest .mark .parametrize (
144
132
"transport_class,transport_name" ,
145
133
[
146
134
(transports .ContainerAnalysisGrpcTransport , "grpc" ),
147
135
(transports .ContainerAnalysisGrpcAsyncIOTransport , "grpc_asyncio" ),
148
136
],
149
137
)
150
- def test_container_analysis_client_service_account_always_use_jwt_true (
138
+ def test_container_analysis_client_service_account_always_use_jwt (
151
139
transport_class , transport_name
152
140
):
153
141
with mock .patch .object (
@@ -157,6 +145,13 @@ def test_container_analysis_client_service_account_always_use_jwt_true(
157
145
transport = transport_class (credentials = creds , always_use_jwt_access = True )
158
146
use_jwt .assert_called_once_with (True )
159
147
148
+ with mock .patch .object (
149
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
150
+ ) as use_jwt :
151
+ creds = service_account .Credentials (None , None , None )
152
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
153
+ use_jwt .assert_not_called ()
154
+
160
155
161
156
@pytest .mark .parametrize (
162
157
"client_class" , [ContainerAnalysisClient , ContainerAnalysisAsyncClient ,]
@@ -237,6 +232,7 @@ def test_container_analysis_client_client_options(
237
232
client_cert_source_for_mtls = None ,
238
233
quota_project_id = None ,
239
234
client_info = transports .base .DEFAULT_CLIENT_INFO ,
235
+ always_use_jwt_access = True ,
240
236
)
241
237
242
238
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -253,6 +249,7 @@ def test_container_analysis_client_client_options(
253
249
client_cert_source_for_mtls = None ,
254
250
quota_project_id = None ,
255
251
client_info = transports .base .DEFAULT_CLIENT_INFO ,
252
+ always_use_jwt_access = True ,
256
253
)
257
254
258
255
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -269,6 +266,7 @@ def test_container_analysis_client_client_options(
269
266
client_cert_source_for_mtls = None ,
270
267
quota_project_id = None ,
271
268
client_info = transports .base .DEFAULT_CLIENT_INFO ,
269
+ always_use_jwt_access = True ,
272
270
)
273
271
274
272
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -297,6 +295,7 @@ def test_container_analysis_client_client_options(
297
295
client_cert_source_for_mtls = None ,
298
296
quota_project_id = "octopus" ,
299
297
client_info = transports .base .DEFAULT_CLIENT_INFO ,
298
+ always_use_jwt_access = True ,
300
299
)
301
300
302
301
@@ -373,6 +372,7 @@ def test_container_analysis_client_mtls_env_auto(
373
372
client_cert_source_for_mtls = expected_client_cert_source ,
374
373
quota_project_id = None ,
375
374
client_info = transports .base .DEFAULT_CLIENT_INFO ,
375
+ always_use_jwt_access = True ,
376
376
)
377
377
378
378
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -406,6 +406,7 @@ def test_container_analysis_client_mtls_env_auto(
406
406
client_cert_source_for_mtls = expected_client_cert_source ,
407
407
quota_project_id = None ,
408
408
client_info = transports .base .DEFAULT_CLIENT_INFO ,
409
+ always_use_jwt_access = True ,
409
410
)
410
411
411
412
# Check the case client_cert_source and ADC client cert are not provided.
@@ -427,6 +428,7 @@ def test_container_analysis_client_mtls_env_auto(
427
428
client_cert_source_for_mtls = None ,
428
429
quota_project_id = None ,
429
430
client_info = transports .base .DEFAULT_CLIENT_INFO ,
431
+ always_use_jwt_access = True ,
430
432
)
431
433
432
434
@@ -457,6 +459,7 @@ def test_container_analysis_client_client_options_scopes(
457
459
client_cert_source_for_mtls = None ,
458
460
quota_project_id = None ,
459
461
client_info = transports .base .DEFAULT_CLIENT_INFO ,
462
+ always_use_jwt_access = True ,
460
463
)
461
464
462
465
@@ -487,6 +490,7 @@ def test_container_analysis_client_client_options_credentials_file(
487
490
client_cert_source_for_mtls = None ,
488
491
quota_project_id = None ,
489
492
client_info = transports .base .DEFAULT_CLIENT_INFO ,
493
+ always_use_jwt_access = True ,
490
494
)
491
495
492
496
@@ -506,6 +510,7 @@ def test_container_analysis_client_client_options_from_dict():
506
510
client_cert_source_for_mtls = None ,
507
511
quota_project_id = None ,
508
512
client_info = transports .base .DEFAULT_CLIENT_INFO ,
513
+ always_use_jwt_access = True ,
509
514
)
510
515
511
516
0 commit comments