@@ -115,24 +115,14 @@ def test_iam_checker_client_from_service_account_info(client_class):
115115 assert client .transport ._host == "policytroubleshooter.googleapis.com:443"
116116
117117
118- @pytest .mark .parametrize ("client_class" , [IamCheckerClient , IamCheckerAsyncClient ,])
119- def test_iam_checker_client_service_account_always_use_jwt (client_class ):
120- with mock .patch .object (
121- service_account .Credentials , "with_always_use_jwt_access" , create = True
122- ) as use_jwt :
123- creds = service_account .Credentials (None , None , None )
124- client = client_class (credentials = creds )
125- use_jwt .assert_not_called ()
126-
127-
128118@pytest .mark .parametrize (
129119 "transport_class,transport_name" ,
130120 [
131121 (transports .IamCheckerGrpcTransport , "grpc" ),
132122 (transports .IamCheckerGrpcAsyncIOTransport , "grpc_asyncio" ),
133123 ],
134124)
135- def test_iam_checker_client_service_account_always_use_jwt_true (
125+ def test_iam_checker_client_service_account_always_use_jwt (
136126 transport_class , transport_name
137127):
138128 with mock .patch .object (
@@ -142,6 +132,13 @@ def test_iam_checker_client_service_account_always_use_jwt_true(
142132 transport = transport_class (credentials = creds , always_use_jwt_access = True )
143133 use_jwt .assert_called_once_with (True )
144134
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+ transport = transport_class (credentials = creds , always_use_jwt_access = False )
140+ use_jwt .assert_not_called ()
141+
145142
146143@pytest .mark .parametrize ("client_class" , [IamCheckerClient , IamCheckerAsyncClient ,])
147144def test_iam_checker_client_from_service_account_file (client_class ):
@@ -218,6 +215,7 @@ def test_iam_checker_client_client_options(
218215 client_cert_source_for_mtls = None ,
219216 quota_project_id = None ,
220217 client_info = transports .base .DEFAULT_CLIENT_INFO ,
218+ always_use_jwt_access = True ,
221219 )
222220
223221 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -234,6 +232,7 @@ def test_iam_checker_client_client_options(
234232 client_cert_source_for_mtls = None ,
235233 quota_project_id = None ,
236234 client_info = transports .base .DEFAULT_CLIENT_INFO ,
235+ always_use_jwt_access = True ,
237236 )
238237
239238 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -250,6 +249,7 @@ def test_iam_checker_client_client_options(
250249 client_cert_source_for_mtls = None ,
251250 quota_project_id = None ,
252251 client_info = transports .base .DEFAULT_CLIENT_INFO ,
252+ always_use_jwt_access = True ,
253253 )
254254
255255 # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -278,6 +278,7 @@ def test_iam_checker_client_client_options(
278278 client_cert_source_for_mtls = None ,
279279 quota_project_id = "octopus" ,
280280 client_info = transports .base .DEFAULT_CLIENT_INFO ,
281+ always_use_jwt_access = True ,
281282 )
282283
283284
@@ -342,6 +343,7 @@ def test_iam_checker_client_mtls_env_auto(
342343 client_cert_source_for_mtls = expected_client_cert_source ,
343344 quota_project_id = None ,
344345 client_info = transports .base .DEFAULT_CLIENT_INFO ,
346+ always_use_jwt_access = True ,
345347 )
346348
347349 # Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -375,6 +377,7 @@ def test_iam_checker_client_mtls_env_auto(
375377 client_cert_source_for_mtls = expected_client_cert_source ,
376378 quota_project_id = None ,
377379 client_info = transports .base .DEFAULT_CLIENT_INFO ,
380+ always_use_jwt_access = True ,
378381 )
379382
380383 # Check the case client_cert_source and ADC client cert are not provided.
@@ -396,6 +399,7 @@ def test_iam_checker_client_mtls_env_auto(
396399 client_cert_source_for_mtls = None ,
397400 quota_project_id = None ,
398401 client_info = transports .base .DEFAULT_CLIENT_INFO ,
402+ always_use_jwt_access = True ,
399403 )
400404
401405
@@ -426,6 +430,7 @@ def test_iam_checker_client_client_options_scopes(
426430 client_cert_source_for_mtls = None ,
427431 quota_project_id = None ,
428432 client_info = transports .base .DEFAULT_CLIENT_INFO ,
433+ always_use_jwt_access = True ,
429434 )
430435
431436
@@ -456,6 +461,7 @@ def test_iam_checker_client_client_options_credentials_file(
456461 client_cert_source_for_mtls = None ,
457462 quota_project_id = None ,
458463 client_info = transports .base .DEFAULT_CLIENT_INFO ,
464+ always_use_jwt_access = True ,
459465 )
460466
461467
@@ -473,6 +479,7 @@ def test_iam_checker_client_client_options_from_dict():
473479 client_cert_source_for_mtls = None ,
474480 quota_project_id = None ,
475481 client_info = transports .base .DEFAULT_CLIENT_INFO ,
482+ always_use_jwt_access = True ,
476483 )
477484
478485
0 commit comments