@@ -250,20 +250,20 @@ def test_environments_client_client_options(
250250 # unsupported value.
251251 with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
252252 with pytest .raises (MutualTLSChannelError ):
253- client = client_class ()
253+ client = client_class (transport = transport_name )
254254
255255 # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
256256 with mock .patch .dict (
257257 os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
258258 ):
259259 with pytest .raises (ValueError ):
260- client = client_class ()
260+ client = client_class (transport = transport_name )
261261
262262 # Check the case quota_project_id is provided
263263 options = client_options .ClientOptions (quota_project_id = "octopus" )
264264 with mock .patch .object (transport_class , "__init__" ) as patched :
265265 patched .return_value = None
266- client = client_class (transport = transport_name , client_options = options )
266+ client = client_class (client_options = options , transport = transport_name )
267267 patched .assert_called_once_with (
268268 credentials = None ,
269269 credentials_file = None ,
@@ -320,7 +320,7 @@ def test_environments_client_mtls_env_auto(
320320 )
321321 with mock .patch .object (transport_class , "__init__" ) as patched :
322322 patched .return_value = None
323- client = client_class (transport = transport_name , client_options = options )
323+ client = client_class (client_options = options , transport = transport_name )
324324
325325 if use_client_cert_env == "false" :
326326 expected_client_cert_source = None
@@ -415,7 +415,7 @@ def test_environments_client_client_options_scopes(
415415 options = client_options .ClientOptions (scopes = ["1" , "2" ],)
416416 with mock .patch .object (transport_class , "__init__" ) as patched :
417417 patched .return_value = None
418- client = client_class (transport = transport_name , client_options = options )
418+ client = client_class (client_options = options , transport = transport_name )
419419 patched .assert_called_once_with (
420420 credentials = None ,
421421 credentials_file = None ,
@@ -446,7 +446,7 @@ def test_environments_client_client_options_credentials_file(
446446 options = client_options .ClientOptions (credentials_file = "credentials.json" )
447447 with mock .patch .object (transport_class , "__init__" ) as patched :
448448 patched .return_value = None
449- client = client_class (transport = transport_name , client_options = options )
449+ client = client_class (client_options = options , transport = transport_name )
450450 patched .assert_called_once_with (
451451 credentials = None ,
452452 credentials_file = "credentials.json" ,
@@ -477,9 +477,8 @@ def test_environments_client_client_options_from_dict():
477477 )
478478
479479
480- def test_create_environment (
481- transport : str = "grpc" , request_type = environments .CreateEnvironmentRequest
482- ):
480+ @pytest .mark .parametrize ("request_type" , [environments .CreateEnvironmentRequest , dict ,])
481+ def test_create_environment (request_type , transport : str = "grpc" ):
483482 client = EnvironmentsClient (
484483 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
485484 )
@@ -505,10 +504,6 @@ def test_create_environment(
505504 assert isinstance (response , future .Future )
506505
507506
508- def test_create_environment_from_dict ():
509- test_create_environment (request_type = dict )
510-
511-
512507def test_create_environment_empty_call ():
513508 # This test is a coverage failsafe to make sure that totally empty calls,
514509 # i.e. request == None and no flattened fields passed, work.
@@ -705,9 +700,8 @@ async def test_create_environment_flattened_error_async():
705700 )
706701
707702
708- def test_get_environment (
709- transport : str = "grpc" , request_type = environments .GetEnvironmentRequest
710- ):
703+ @pytest .mark .parametrize ("request_type" , [environments .GetEnvironmentRequest , dict ,])
704+ def test_get_environment (request_type , transport : str = "grpc" ):
711705 client = EnvironmentsClient (
712706 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
713707 )
@@ -738,10 +732,6 @@ def test_get_environment(
738732 assert response .state == environments .Environment .State .CREATING
739733
740734
741- def test_get_environment_from_dict ():
742- test_get_environment (request_type = dict )
743-
744-
745735def test_get_environment_empty_call ():
746736 # This test is a coverage failsafe to make sure that totally empty calls,
747737 # i.e. request == None and no flattened fields passed, work.
@@ -917,9 +907,8 @@ async def test_get_environment_flattened_error_async():
917907 )
918908
919909
920- def test_list_environments (
921- transport : str = "grpc" , request_type = environments .ListEnvironmentsRequest
922- ):
910+ @pytest .mark .parametrize ("request_type" , [environments .ListEnvironmentsRequest , dict ,])
911+ def test_list_environments (request_type , transport : str = "grpc" ):
923912 client = EnvironmentsClient (
924913 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
925914 )
@@ -948,10 +937,6 @@ def test_list_environments(
948937 assert response .next_page_token == "next_page_token_value"
949938
950939
951- def test_list_environments_from_dict ():
952- test_list_environments (request_type = dict )
953-
954-
955940def test_list_environments_empty_call ():
956941 # This test is a coverage failsafe to make sure that totally empty calls,
957942 # i.e. request == None and no flattened fields passed, work.
@@ -1135,8 +1120,10 @@ async def test_list_environments_flattened_error_async():
11351120 )
11361121
11371122
1138- def test_list_environments_pager ():
1139- client = EnvironmentsClient (credentials = ga_credentials .AnonymousCredentials ,)
1123+ def test_list_environments_pager (transport_name : str = "grpc" ):
1124+ client = EnvironmentsClient (
1125+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
1126+ )
11401127
11411128 # Mock the actual call within the gRPC stub, and fake the request.
11421129 with mock .patch .object (
@@ -1177,8 +1164,10 @@ def test_list_environments_pager():
11771164 assert all (isinstance (i , environments .Environment ) for i in results )
11781165
11791166
1180- def test_list_environments_pages ():
1181- client = EnvironmentsClient (credentials = ga_credentials .AnonymousCredentials ,)
1167+ def test_list_environments_pages (transport_name : str = "grpc" ):
1168+ client = EnvironmentsClient (
1169+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
1170+ )
11821171
11831172 # Mock the actual call within the gRPC stub, and fake the request.
11841173 with mock .patch .object (
@@ -1289,9 +1278,8 @@ async def test_list_environments_async_pages():
12891278 assert page_ .raw_page .next_page_token == token
12901279
12911280
1292- def test_update_environment (
1293- transport : str = "grpc" , request_type = environments .UpdateEnvironmentRequest
1294- ):
1281+ @pytest .mark .parametrize ("request_type" , [environments .UpdateEnvironmentRequest , dict ,])
1282+ def test_update_environment (request_type , transport : str = "grpc" ):
12951283 client = EnvironmentsClient (
12961284 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
12971285 )
@@ -1317,10 +1305,6 @@ def test_update_environment(
13171305 assert isinstance (response , future .Future )
13181306
13191307
1320- def test_update_environment_from_dict ():
1321- test_update_environment (request_type = dict )
1322-
1323-
13241308def test_update_environment_empty_call ():
13251309 # This test is a coverage failsafe to make sure that totally empty calls,
13261310 # i.e. request == None and no flattened fields passed, work.
@@ -1527,9 +1511,8 @@ async def test_update_environment_flattened_error_async():
15271511 )
15281512
15291513
1530- def test_delete_environment (
1531- transport : str = "grpc" , request_type = environments .DeleteEnvironmentRequest
1532- ):
1514+ @pytest .mark .parametrize ("request_type" , [environments .DeleteEnvironmentRequest , dict ,])
1515+ def test_delete_environment (request_type , transport : str = "grpc" ):
15331516 client = EnvironmentsClient (
15341517 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
15351518 )
@@ -1555,10 +1538,6 @@ def test_delete_environment(
15551538 assert isinstance (response , future .Future )
15561539
15571540
1558- def test_delete_environment_from_dict ():
1559- test_delete_environment (request_type = dict )
1560-
1561-
15621541def test_delete_environment_empty_call ():
15631542 # This test is a coverage failsafe to make sure that totally empty calls,
15641543 # i.e. request == None and no flattened fields passed, work.
@@ -2277,7 +2256,7 @@ def test_parse_common_location_path():
22772256 assert expected == actual
22782257
22792258
2280- def test_client_withDEFAULT_CLIENT_INFO ():
2259+ def test_client_with_default_client_info ():
22812260 client_info = gapic_v1 .client_info .ClientInfo ()
22822261
22832262 with mock .patch .object (
0 commit comments