@@ -143,24 +143,6 @@ def test_binauthz_management_service_v1_beta1_client_from_service_account_info(
143143 assert client .transport ._host == "binaryauthorization.googleapis.com:443"
144144
145145
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-
164146@pytest .mark .parametrize (
165147 "transport_class,transport_name" ,
166148 [
@@ -171,7 +153,7 @@ def test_binauthz_management_service_v1_beta1_client_service_account_always_use_
171153 ),
172154 ],
173155)
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 (
175157 transport_class , transport_name
176158):
177159 with mock .patch .object (
@@ -181,6 +163,13 @@ def test_binauthz_management_service_v1_beta1_client_service_account_always_use_
181163 transport = transport_class (credentials = creds , always_use_jwt_access = True )
182164 use_jwt .assert_called_once_with (True )
183165
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+
184173
185174@pytest .mark .parametrize (
186175 "client_class" ,
@@ -275,6 +264,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options(
275264 client_cert_source_for_mtls = None ,
276265 quota_project_id = None ,
277266 client_info = transports .base .DEFAULT_CLIENT_INFO ,
267+ always_use_jwt_access = True ,
278268 )
279269
280270 # 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(
291281 client_cert_source_for_mtls = None ,
292282 quota_project_id = None ,
293283 client_info = transports .base .DEFAULT_CLIENT_INFO ,
284+ always_use_jwt_access = True ,
294285 )
295286
296287 # 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(
307298 client_cert_source_for_mtls = None ,
308299 quota_project_id = None ,
309300 client_info = transports .base .DEFAULT_CLIENT_INFO ,
301+ always_use_jwt_access = True ,
310302 )
311303
312304 # 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(
335327 client_cert_source_for_mtls = None ,
336328 quota_project_id = "octopus" ,
337329 client_info = transports .base .DEFAULT_CLIENT_INFO ,
330+ always_use_jwt_access = True ,
338331 )
339332
340333
@@ -411,6 +404,7 @@ def test_binauthz_management_service_v1_beta1_client_mtls_env_auto(
411404 client_cert_source_for_mtls = expected_client_cert_source ,
412405 quota_project_id = None ,
413406 client_info = transports .base .DEFAULT_CLIENT_INFO ,
407+ always_use_jwt_access = True ,
414408 )
415409
416410 # 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(
444438 client_cert_source_for_mtls = expected_client_cert_source ,
445439 quota_project_id = None ,
446440 client_info = transports .base .DEFAULT_CLIENT_INFO ,
441+ always_use_jwt_access = True ,
447442 )
448443
449444 # 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(
465460 client_cert_source_for_mtls = None ,
466461 quota_project_id = None ,
467462 client_info = transports .base .DEFAULT_CLIENT_INFO ,
463+ always_use_jwt_access = True ,
468464 )
469465
470466
@@ -499,6 +495,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options_scopes(
499495 client_cert_source_for_mtls = None ,
500496 quota_project_id = None ,
501497 client_info = transports .base .DEFAULT_CLIENT_INFO ,
498+ always_use_jwt_access = True ,
502499 )
503500
504501
@@ -533,6 +530,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options_credentials_
533530 client_cert_source_for_mtls = None ,
534531 quota_project_id = None ,
535532 client_info = transports .base .DEFAULT_CLIENT_INFO ,
533+ always_use_jwt_access = True ,
536534 )
537535
538536
@@ -552,6 +550,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options_from_dict():
552550 client_cert_source_for_mtls = None ,
553551 quota_project_id = None ,
554552 client_info = transports .base .DEFAULT_CLIENT_INFO ,
553+ always_use_jwt_access = True ,
555554 )
556555
557556
0 commit comments