@@ -143,24 +143,6 @@ def test_binauthz_management_service_v1_beta1_client_from_service_account_info(
143
143
assert client .transport ._host == "binaryauthorization.googleapis.com:443"
144
144
145
145
146
- @pytest .mark .parametrize (
147
- "client_class" ,
148
- [
149
- BinauthzManagementServiceV1Beta1Client ,
150
- BinauthzManagementServiceV1Beta1AsyncClient ,
151
- ],
152
- )
153
- def test_binauthz_management_service_v1_beta1_client_service_account_always_use_jwt (
154
- client_class ,
155
- ):
156
- with mock .patch .object (
157
- service_account .Credentials , "with_always_use_jwt_access" , create = True
158
- ) as use_jwt :
159
- creds = service_account .Credentials (None , None , None )
160
- client = client_class (credentials = creds )
161
- use_jwt .assert_not_called ()
162
-
163
-
164
146
@pytest .mark .parametrize (
165
147
"transport_class,transport_name" ,
166
148
[
@@ -171,7 +153,7 @@ def test_binauthz_management_service_v1_beta1_client_service_account_always_use_
171
153
),
172
154
],
173
155
)
174
- def test_binauthz_management_service_v1_beta1_client_service_account_always_use_jwt_true (
156
+ def test_binauthz_management_service_v1_beta1_client_service_account_always_use_jwt (
175
157
transport_class , transport_name
176
158
):
177
159
with mock .patch .object (
@@ -181,6 +163,13 @@ def test_binauthz_management_service_v1_beta1_client_service_account_always_use_
181
163
transport = transport_class (credentials = creds , always_use_jwt_access = True )
182
164
use_jwt .assert_called_once_with (True )
183
165
166
+ with mock .patch .object (
167
+ service_account .Credentials , "with_always_use_jwt_access" , create = True
168
+ ) as use_jwt :
169
+ creds = service_account .Credentials (None , None , None )
170
+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
171
+ use_jwt .assert_not_called ()
172
+
184
173
185
174
@pytest .mark .parametrize (
186
175
"client_class" ,
@@ -275,6 +264,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options(
275
264
client_cert_source_for_mtls = None ,
276
265
quota_project_id = None ,
277
266
client_info = transports .base .DEFAULT_CLIENT_INFO ,
267
+ always_use_jwt_access = True ,
278
268
)
279
269
280
270
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -291,6 +281,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options(
291
281
client_cert_source_for_mtls = None ,
292
282
quota_project_id = None ,
293
283
client_info = transports .base .DEFAULT_CLIENT_INFO ,
284
+ always_use_jwt_access = True ,
294
285
)
295
286
296
287
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -307,6 +298,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options(
307
298
client_cert_source_for_mtls = None ,
308
299
quota_project_id = None ,
309
300
client_info = transports .base .DEFAULT_CLIENT_INFO ,
301
+ always_use_jwt_access = True ,
310
302
)
311
303
312
304
# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -335,6 +327,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options(
335
327
client_cert_source_for_mtls = None ,
336
328
quota_project_id = "octopus" ,
337
329
client_info = transports .base .DEFAULT_CLIENT_INFO ,
330
+ always_use_jwt_access = True ,
338
331
)
339
332
340
333
@@ -411,6 +404,7 @@ def test_binauthz_management_service_v1_beta1_client_mtls_env_auto(
411
404
client_cert_source_for_mtls = expected_client_cert_source ,
412
405
quota_project_id = None ,
413
406
client_info = transports .base .DEFAULT_CLIENT_INFO ,
407
+ always_use_jwt_access = True ,
414
408
)
415
409
416
410
# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -444,6 +438,7 @@ def test_binauthz_management_service_v1_beta1_client_mtls_env_auto(
444
438
client_cert_source_for_mtls = expected_client_cert_source ,
445
439
quota_project_id = None ,
446
440
client_info = transports .base .DEFAULT_CLIENT_INFO ,
441
+ always_use_jwt_access = True ,
447
442
)
448
443
449
444
# Check the case client_cert_source and ADC client cert are not provided.
@@ -465,6 +460,7 @@ def test_binauthz_management_service_v1_beta1_client_mtls_env_auto(
465
460
client_cert_source_for_mtls = None ,
466
461
quota_project_id = None ,
467
462
client_info = transports .base .DEFAULT_CLIENT_INFO ,
463
+ always_use_jwt_access = True ,
468
464
)
469
465
470
466
@@ -499,6 +495,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options_scopes(
499
495
client_cert_source_for_mtls = None ,
500
496
quota_project_id = None ,
501
497
client_info = transports .base .DEFAULT_CLIENT_INFO ,
498
+ always_use_jwt_access = True ,
502
499
)
503
500
504
501
@@ -533,6 +530,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options_credentials_
533
530
client_cert_source_for_mtls = None ,
534
531
quota_project_id = None ,
535
532
client_info = transports .base .DEFAULT_CLIENT_INFO ,
533
+ always_use_jwt_access = True ,
536
534
)
537
535
538
536
@@ -552,6 +550,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options_from_dict():
552
550
client_cert_source_for_mtls = None ,
553
551
quota_project_id = None ,
554
552
client_info = transports .base .DEFAULT_CLIENT_INFO ,
553
+ always_use_jwt_access = True ,
555
554
)
556
555
557
556
0 commit comments