@@ -128,26 +128,14 @@ def test_container_analysis_client_from_service_account_info(client_class):
128128 assert client .transport ._host == "containeranalysis.googleapis.com:443"
129129
130130
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-
143131@pytest .mark .parametrize (
144132 "transport_class,transport_name" ,
145133 [
146134 (transports .ContainerAnalysisGrpcTransport , "grpc" ),
147135 (transports .ContainerAnalysisGrpcAsyncIOTransport , "grpc_asyncio" ),
148136 ],
149137)
150- def test_container_analysis_client_service_account_always_use_jwt_true (
138+ def test_container_analysis_client_service_account_always_use_jwt (
151139 transport_class , transport_name
152140):
153141 with mock .patch .object (
@@ -157,6 +145,13 @@ def test_container_analysis_client_service_account_always_use_jwt_true(
157145 transport = transport_class (credentials = creds , always_use_jwt_access = True )
158146 use_jwt .assert_called_once_with (True )
159147
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+
160155
161156@pytest .mark .parametrize (
162157 "client_class" , [ContainerAnalysisClient , ContainerAnalysisAsyncClient ,]
@@ -237,6 +232,7 @@ def test_container_analysis_client_client_options(
237232 client_cert_source_for_mtls = None ,
238233 quota_project_id = None ,
239234 client_info = transports .base .DEFAULT_CLIENT_INFO ,
235+ always_use_jwt_access = True ,
240236 )
241237
242238 # 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(
253249 client_cert_source_for_mtls = None ,
254250 quota_project_id = None ,
255251 client_info = transports .base .DEFAULT_CLIENT_INFO ,
252+ always_use_jwt_access = True ,
256253 )
257254
258255 # 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(
269266 client_cert_source_for_mtls = None ,
270267 quota_project_id = None ,
271268 client_info = transports .base .DEFAULT_CLIENT_INFO ,
269+ always_use_jwt_access = True ,
272270 )
273271
274272 # 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(
297295 client_cert_source_for_mtls = None ,
298296 quota_project_id = "octopus" ,
299297 client_info = transports .base .DEFAULT_CLIENT_INFO ,
298+ always_use_jwt_access = True ,
300299 )
301300
302301
@@ -373,6 +372,7 @@ def test_container_analysis_client_mtls_env_auto(
373372 client_cert_source_for_mtls = expected_client_cert_source ,
374373 quota_project_id = None ,
375374 client_info = transports .base .DEFAULT_CLIENT_INFO ,
375+ always_use_jwt_access = True ,
376376 )
377377
378378 # 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(
406406 client_cert_source_for_mtls = expected_client_cert_source ,
407407 quota_project_id = None ,
408408 client_info = transports .base .DEFAULT_CLIENT_INFO ,
409+ always_use_jwt_access = True ,
409410 )
410411
411412 # 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(
427428 client_cert_source_for_mtls = None ,
428429 quota_project_id = None ,
429430 client_info = transports .base .DEFAULT_CLIENT_INFO ,
431+ always_use_jwt_access = True ,
430432 )
431433
432434
@@ -457,6 +459,7 @@ def test_container_analysis_client_client_options_scopes(
457459 client_cert_source_for_mtls = None ,
458460 quota_project_id = None ,
459461 client_info = transports .base .DEFAULT_CLIENT_INFO ,
462+ always_use_jwt_access = True ,
460463 )
461464
462465
@@ -487,6 +490,7 @@ def test_container_analysis_client_client_options_credentials_file(
487490 client_cert_source_for_mtls = None ,
488491 quota_project_id = None ,
489492 client_info = transports .base .DEFAULT_CLIENT_INFO ,
493+ always_use_jwt_access = True ,
490494 )
491495
492496
@@ -506,6 +510,7 @@ def test_container_analysis_client_client_options_from_dict():
506510 client_cert_source_for_mtls = None ,
507511 quota_project_id = None ,
508512 client_info = transports .base .DEFAULT_CLIENT_INFO ,
513+ always_use_jwt_access = True ,
509514 )
510515
511516
0 commit comments