@@ -242,20 +242,20 @@ def test_service_usage_client_client_options(
242242 # unsupported value.
243243 with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
244244 with pytest .raises (MutualTLSChannelError ):
245- client = client_class ()
245+ client = client_class (transport = transport_name )
246246
247247 # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
248248 with mock .patch .dict (
249249 os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
250250 ):
251251 with pytest .raises (ValueError ):
252- client = client_class ()
252+ client = client_class (transport = transport_name )
253253
254254 # Check the case quota_project_id is provided
255255 options = client_options .ClientOptions (quota_project_id = "octopus" )
256256 with mock .patch .object (transport_class , "__init__" ) as patched :
257257 patched .return_value = None
258- client = client_class (transport = transport_name , client_options = options )
258+ client = client_class (client_options = options , transport = transport_name )
259259 patched .assert_called_once_with (
260260 credentials = None ,
261261 credentials_file = None ,
@@ -312,7 +312,7 @@ def test_service_usage_client_mtls_env_auto(
312312 )
313313 with mock .patch .object (transport_class , "__init__" ) as patched :
314314 patched .return_value = None
315- client = client_class (transport = transport_name , client_options = options )
315+ client = client_class (client_options = options , transport = transport_name )
316316
317317 if use_client_cert_env == "false" :
318318 expected_client_cert_source = None
@@ -407,7 +407,7 @@ def test_service_usage_client_client_options_scopes(
407407 options = client_options .ClientOptions (scopes = ["1" , "2" ],)
408408 with mock .patch .object (transport_class , "__init__" ) as patched :
409409 patched .return_value = None
410- client = client_class (transport = transport_name , client_options = options )
410+ client = client_class (client_options = options , transport = transport_name )
411411 patched .assert_called_once_with (
412412 credentials = None ,
413413 credentials_file = None ,
@@ -438,7 +438,7 @@ def test_service_usage_client_client_options_credentials_file(
438438 options = client_options .ClientOptions (credentials_file = "credentials.json" )
439439 with mock .patch .object (transport_class , "__init__" ) as patched :
440440 patched .return_value = None
441- client = client_class (transport = transport_name , client_options = options )
441+ client = client_class (client_options = options , transport = transport_name )
442442 patched .assert_called_once_with (
443443 credentials = None ,
444444 credentials_file = "credentials.json" ,
@@ -469,9 +469,8 @@ def test_service_usage_client_client_options_from_dict():
469469 )
470470
471471
472- def test_enable_service (
473- transport : str = "grpc" , request_type = serviceusage .EnableServiceRequest
474- ):
472+ @pytest .mark .parametrize ("request_type" , [serviceusage .EnableServiceRequest , dict ,])
473+ def test_enable_service (request_type , transport : str = "grpc" ):
475474 client = ServiceUsageClient (
476475 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
477476 )
@@ -495,10 +494,6 @@ def test_enable_service(
495494 assert isinstance (response , future .Future )
496495
497496
498- def test_enable_service_from_dict ():
499- test_enable_service (request_type = dict )
500-
501-
502497def test_enable_service_empty_call ():
503498 # This test is a coverage failsafe to make sure that totally empty calls,
504499 # i.e. request == None and no flattened fields passed, work.
@@ -599,9 +594,8 @@ async def test_enable_service_field_headers_async():
599594 assert ("x-goog-request-params" , "name=name/value" ,) in kw ["metadata" ]
600595
601596
602- def test_disable_service (
603- transport : str = "grpc" , request_type = serviceusage .DisableServiceRequest
604- ):
597+ @pytest .mark .parametrize ("request_type" , [serviceusage .DisableServiceRequest , dict ,])
598+ def test_disable_service (request_type , transport : str = "grpc" ):
605599 client = ServiceUsageClient (
606600 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
607601 )
@@ -625,10 +619,6 @@ def test_disable_service(
625619 assert isinstance (response , future .Future )
626620
627621
628- def test_disable_service_from_dict ():
629- test_disable_service (request_type = dict )
630-
631-
632622def test_disable_service_empty_call ():
633623 # This test is a coverage failsafe to make sure that totally empty calls,
634624 # i.e. request == None and no flattened fields passed, work.
@@ -729,9 +719,8 @@ async def test_disable_service_field_headers_async():
729719 assert ("x-goog-request-params" , "name=name/value" ,) in kw ["metadata" ]
730720
731721
732- def test_get_service (
733- transport : str = "grpc" , request_type = serviceusage .GetServiceRequest
734- ):
722+ @pytest .mark .parametrize ("request_type" , [serviceusage .GetServiceRequest , dict ,])
723+ def test_get_service (request_type , transport : str = "grpc" ):
735724 client = ServiceUsageClient (
736725 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
737726 )
@@ -760,10 +749,6 @@ def test_get_service(
760749 assert response .state == resources .State .DISABLED
761750
762751
763- def test_get_service_from_dict ():
764- test_get_service (request_type = dict )
765-
766-
767752def test_get_service_empty_call ():
768753 # This test is a coverage failsafe to make sure that totally empty calls,
769754 # i.e. request == None and no flattened fields passed, work.
@@ -869,9 +854,8 @@ async def test_get_service_field_headers_async():
869854 assert ("x-goog-request-params" , "name=name/value" ,) in kw ["metadata" ]
870855
871856
872- def test_list_services (
873- transport : str = "grpc" , request_type = serviceusage .ListServicesRequest
874- ):
857+ @pytest .mark .parametrize ("request_type" , [serviceusage .ListServicesRequest , dict ,])
858+ def test_list_services (request_type , transport : str = "grpc" ):
875859 client = ServiceUsageClient (
876860 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
877861 )
@@ -898,10 +882,6 @@ def test_list_services(
898882 assert response .next_page_token == "next_page_token_value"
899883
900884
901- def test_list_services_from_dict ():
902- test_list_services (request_type = dict )
903-
904-
905885def test_list_services_empty_call ():
906886 # This test is a coverage failsafe to make sure that totally empty calls,
907887 # i.e. request == None and no flattened fields passed, work.
@@ -1003,8 +983,10 @@ async def test_list_services_field_headers_async():
1003983 assert ("x-goog-request-params" , "parent=parent/value" ,) in kw ["metadata" ]
1004984
1005985
1006- def test_list_services_pager ():
1007- client = ServiceUsageClient (credentials = ga_credentials .AnonymousCredentials ,)
986+ def test_list_services_pager (transport_name : str = "grpc" ):
987+ client = ServiceUsageClient (
988+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
989+ )
1008990
1009991 # Mock the actual call within the gRPC stub, and fake the request.
1010992 with mock .patch .object (type (client .transport .list_services ), "__call__" ) as call :
@@ -1041,8 +1023,10 @@ def test_list_services_pager():
10411023 assert all (isinstance (i , resources .Service ) for i in results )
10421024
10431025
1044- def test_list_services_pages ():
1045- client = ServiceUsageClient (credentials = ga_credentials .AnonymousCredentials ,)
1026+ def test_list_services_pages (transport_name : str = "grpc" ):
1027+ client = ServiceUsageClient (
1028+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
1029+ )
10461030
10471031 # Mock the actual call within the gRPC stub, and fake the request.
10481032 with mock .patch .object (type (client .transport .list_services ), "__call__" ) as call :
@@ -1141,9 +1125,10 @@ async def test_list_services_async_pages():
11411125 assert page_ .raw_page .next_page_token == token
11421126
11431127
1144- def test_batch_enable_services (
1145- transport : str = "grpc" , request_type = serviceusage .BatchEnableServicesRequest
1146- ):
1128+ @pytest .mark .parametrize (
1129+ "request_type" , [serviceusage .BatchEnableServicesRequest , dict ,]
1130+ )
1131+ def test_batch_enable_services (request_type , transport : str = "grpc" ):
11471132 client = ServiceUsageClient (
11481133 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
11491134 )
@@ -1169,10 +1154,6 @@ def test_batch_enable_services(
11691154 assert isinstance (response , future .Future )
11701155
11711156
1172- def test_batch_enable_services_from_dict ():
1173- test_batch_enable_services (request_type = dict )
1174-
1175-
11761157def test_batch_enable_services_empty_call ():
11771158 # This test is a coverage failsafe to make sure that totally empty calls,
11781159 # i.e. request == None and no flattened fields passed, work.
@@ -1282,9 +1263,8 @@ async def test_batch_enable_services_field_headers_async():
12821263 assert ("x-goog-request-params" , "parent=parent/value" ,) in kw ["metadata" ]
12831264
12841265
1285- def test_batch_get_services (
1286- transport : str = "grpc" , request_type = serviceusage .BatchGetServicesRequest
1287- ):
1266+ @pytest .mark .parametrize ("request_type" , [serviceusage .BatchGetServicesRequest , dict ,])
1267+ def test_batch_get_services (request_type , transport : str = "grpc" ):
12881268 client = ServiceUsageClient (
12891269 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
12901270 )
@@ -1310,10 +1290,6 @@ def test_batch_get_services(
13101290 assert isinstance (response , serviceusage .BatchGetServicesResponse )
13111291
13121292
1313- def test_batch_get_services_from_dict ():
1314- test_batch_get_services (request_type = dict )
1315-
1316-
13171293def test_batch_get_services_empty_call ():
13181294 # This test is a coverage failsafe to make sure that totally empty calls,
13191295 # i.e. request == None and no flattened fields passed, work.
@@ -1953,7 +1929,7 @@ def test_parse_common_location_path():
19531929 assert expected == actual
19541930
19551931
1956- def test_client_withDEFAULT_CLIENT_INFO ():
1932+ def test_client_with_default_client_info ():
19571933 client_info = gapic_v1 .client_info .ClientInfo ()
19581934
19591935 with mock .patch .object (
0 commit comments