@@ -243,20 +243,20 @@ def test_data_fusion_client_client_options(
243
243
# unsupported value.
244
244
with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
245
245
with pytest .raises (MutualTLSChannelError ):
246
- client = client_class ()
246
+ client = client_class (transport = transport_name )
247
247
248
248
# Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
249
249
with mock .patch .dict (
250
250
os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
251
251
):
252
252
with pytest .raises (ValueError ):
253
- client = client_class ()
253
+ client = client_class (transport = transport_name )
254
254
255
255
# Check the case quota_project_id is provided
256
256
options = client_options .ClientOptions (quota_project_id = "octopus" )
257
257
with mock .patch .object (transport_class , "__init__" ) as patched :
258
258
patched .return_value = None
259
- client = client_class (transport = transport_name , client_options = options )
259
+ client = client_class (client_options = options , transport = transport_name )
260
260
patched .assert_called_once_with (
261
261
credentials = None ,
262
262
credentials_file = None ,
@@ -313,7 +313,7 @@ def test_data_fusion_client_mtls_env_auto(
313
313
)
314
314
with mock .patch .object (transport_class , "__init__" ) as patched :
315
315
patched .return_value = None
316
- client = client_class (transport = transport_name , client_options = options )
316
+ client = client_class (client_options = options , transport = transport_name )
317
317
318
318
if use_client_cert_env == "false" :
319
319
expected_client_cert_source = None
@@ -408,7 +408,7 @@ def test_data_fusion_client_client_options_scopes(
408
408
options = client_options .ClientOptions (scopes = ["1" , "2" ],)
409
409
with mock .patch .object (transport_class , "__init__" ) as patched :
410
410
patched .return_value = None
411
- client = client_class (transport = transport_name , client_options = options )
411
+ client = client_class (client_options = options , transport = transport_name )
412
412
patched .assert_called_once_with (
413
413
credentials = None ,
414
414
credentials_file = None ,
@@ -439,7 +439,7 @@ def test_data_fusion_client_client_options_credentials_file(
439
439
options = client_options .ClientOptions (credentials_file = "credentials.json" )
440
440
with mock .patch .object (transport_class , "__init__" ) as patched :
441
441
patched .return_value = None
442
- client = client_class (transport = transport_name , client_options = options )
442
+ client = client_class (client_options = options , transport = transport_name )
443
443
patched .assert_called_once_with (
444
444
credentials = None ,
445
445
credentials_file = "credentials.json" ,
@@ -470,9 +470,10 @@ def test_data_fusion_client_client_options_from_dict():
470
470
)
471
471
472
472
473
- def test_list_available_versions (
474
- transport : str = "grpc" , request_type = datafusion .ListAvailableVersionsRequest
475
- ):
473
+ @pytest .mark .parametrize (
474
+ "request_type" , [datafusion .ListAvailableVersionsRequest , dict ,]
475
+ )
476
+ def test_list_available_versions (request_type , transport : str = "grpc" ):
476
477
client = DataFusionClient (
477
478
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
478
479
)
@@ -501,10 +502,6 @@ def test_list_available_versions(
501
502
assert response .next_page_token == "next_page_token_value"
502
503
503
504
504
- def test_list_available_versions_from_dict ():
505
- test_list_available_versions (request_type = dict )
506
-
507
-
508
505
def test_list_available_versions_empty_call ():
509
506
# This test is a coverage failsafe to make sure that totally empty calls,
510
507
# i.e. request == None and no flattened fields passed, work.
@@ -689,8 +686,10 @@ async def test_list_available_versions_flattened_error_async():
689
686
)
690
687
691
688
692
- def test_list_available_versions_pager ():
693
- client = DataFusionClient (credentials = ga_credentials .AnonymousCredentials ,)
689
+ def test_list_available_versions_pager (transport_name : str = "grpc" ):
690
+ client = DataFusionClient (
691
+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
692
+ )
694
693
695
694
# Mock the actual call within the gRPC stub, and fake the request.
696
695
with mock .patch .object (
@@ -731,8 +730,10 @@ def test_list_available_versions_pager():
731
730
assert all (isinstance (i , datafusion .Version ) for i in results )
732
731
733
732
734
- def test_list_available_versions_pages ():
735
- client = DataFusionClient (credentials = ga_credentials .AnonymousCredentials ,)
733
+ def test_list_available_versions_pages (transport_name : str = "grpc" ):
734
+ client = DataFusionClient (
735
+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
736
+ )
736
737
737
738
# Mock the actual call within the gRPC stub, and fake the request.
738
739
with mock .patch .object (
@@ -843,9 +844,8 @@ async def test_list_available_versions_async_pages():
843
844
assert page_ .raw_page .next_page_token == token
844
845
845
846
846
- def test_list_instances (
847
- transport : str = "grpc" , request_type = datafusion .ListInstancesRequest
848
- ):
847
+ @pytest .mark .parametrize ("request_type" , [datafusion .ListInstancesRequest , dict ,])
848
+ def test_list_instances (request_type , transport : str = "grpc" ):
849
849
client = DataFusionClient (
850
850
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
851
851
)
@@ -873,10 +873,6 @@ def test_list_instances(
873
873
assert response .unreachable == ["unreachable_value" ]
874
874
875
875
876
- def test_list_instances_from_dict ():
877
- test_list_instances (request_type = dict )
878
-
879
-
880
876
def test_list_instances_empty_call ():
881
877
# This test is a coverage failsafe to make sure that totally empty calls,
882
878
# i.e. request == None and no flattened fields passed, work.
@@ -982,8 +978,10 @@ async def test_list_instances_field_headers_async():
982
978
assert ("x-goog-request-params" , "parent=parent/value" ,) in kw ["metadata" ]
983
979
984
980
985
- def test_list_instances_pager ():
986
- client = DataFusionClient (credentials = ga_credentials .AnonymousCredentials ,)
981
+ def test_list_instances_pager (transport_name : str = "grpc" ):
982
+ client = DataFusionClient (
983
+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
984
+ )
987
985
988
986
# Mock the actual call within the gRPC stub, and fake the request.
989
987
with mock .patch .object (type (client .transport .list_instances ), "__call__" ) as call :
@@ -1020,8 +1018,10 @@ def test_list_instances_pager():
1020
1018
assert all (isinstance (i , datafusion .Instance ) for i in results )
1021
1019
1022
1020
1023
- def test_list_instances_pages ():
1024
- client = DataFusionClient (credentials = ga_credentials .AnonymousCredentials ,)
1021
+ def test_list_instances_pages (transport_name : str = "grpc" ):
1022
+ client = DataFusionClient (
1023
+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
1024
+ )
1025
1025
1026
1026
# Mock the actual call within the gRPC stub, and fake the request.
1027
1027
with mock .patch .object (type (client .transport .list_instances ), "__call__" ) as call :
@@ -1120,9 +1120,8 @@ async def test_list_instances_async_pages():
1120
1120
assert page_ .raw_page .next_page_token == token
1121
1121
1122
1122
1123
- def test_get_instance (
1124
- transport : str = "grpc" , request_type = datafusion .GetInstanceRequest
1125
- ):
1123
+ @pytest .mark .parametrize ("request_type" , [datafusion .GetInstanceRequest , dict ,])
1124
+ def test_get_instance (request_type , transport : str = "grpc" ):
1126
1125
client = DataFusionClient (
1127
1126
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1128
1127
)
@@ -1185,10 +1184,6 @@ def test_get_instance(
1185
1184
assert response .enable_rbac is True
1186
1185
1187
1186
1188
- def test_get_instance_from_dict ():
1189
- test_get_instance (request_type = dict )
1190
-
1191
-
1192
1187
def test_get_instance_empty_call ():
1193
1188
# This test is a coverage failsafe to make sure that totally empty calls,
1194
1189
# i.e. request == None and no flattened fields passed, work.
@@ -1326,9 +1321,8 @@ async def test_get_instance_field_headers_async():
1326
1321
assert ("x-goog-request-params" , "name=name/value" ,) in kw ["metadata" ]
1327
1322
1328
1323
1329
- def test_create_instance (
1330
- transport : str = "grpc" , request_type = datafusion .CreateInstanceRequest
1331
- ):
1324
+ @pytest .mark .parametrize ("request_type" , [datafusion .CreateInstanceRequest , dict ,])
1325
+ def test_create_instance (request_type , transport : str = "grpc" ):
1332
1326
client = DataFusionClient (
1333
1327
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1334
1328
)
@@ -1352,10 +1346,6 @@ def test_create_instance(
1352
1346
assert isinstance (response , future .Future )
1353
1347
1354
1348
1355
- def test_create_instance_from_dict ():
1356
- test_create_instance (request_type = dict )
1357
-
1358
-
1359
1349
def test_create_instance_empty_call ():
1360
1350
# This test is a coverage failsafe to make sure that totally empty calls,
1361
1351
# i.e. request == None and no flattened fields passed, work.
@@ -1550,9 +1540,8 @@ async def test_create_instance_flattened_error_async():
1550
1540
)
1551
1541
1552
1542
1553
- def test_delete_instance (
1554
- transport : str = "grpc" , request_type = datafusion .DeleteInstanceRequest
1555
- ):
1543
+ @pytest .mark .parametrize ("request_type" , [datafusion .DeleteInstanceRequest , dict ,])
1544
+ def test_delete_instance (request_type , transport : str = "grpc" ):
1556
1545
client = DataFusionClient (
1557
1546
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1558
1547
)
@@ -1576,10 +1565,6 @@ def test_delete_instance(
1576
1565
assert isinstance (response , future .Future )
1577
1566
1578
1567
1579
- def test_delete_instance_from_dict ():
1580
- test_delete_instance (request_type = dict )
1581
-
1582
-
1583
1568
def test_delete_instance_empty_call ():
1584
1569
# This test is a coverage failsafe to make sure that totally empty calls,
1585
1570
# i.e. request == None and no flattened fields passed, work.
@@ -1748,9 +1733,8 @@ async def test_delete_instance_flattened_error_async():
1748
1733
)
1749
1734
1750
1735
1751
- def test_update_instance (
1752
- transport : str = "grpc" , request_type = datafusion .UpdateInstanceRequest
1753
- ):
1736
+ @pytest .mark .parametrize ("request_type" , [datafusion .UpdateInstanceRequest , dict ,])
1737
+ def test_update_instance (request_type , transport : str = "grpc" ):
1754
1738
client = DataFusionClient (
1755
1739
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1756
1740
)
@@ -1774,10 +1758,6 @@ def test_update_instance(
1774
1758
assert isinstance (response , future .Future )
1775
1759
1776
1760
1777
- def test_update_instance_from_dict ():
1778
- test_update_instance (request_type = dict )
1779
-
1780
-
1781
1761
def test_update_instance_empty_call ():
1782
1762
# This test is a coverage failsafe to make sure that totally empty calls,
1783
1763
# i.e. request == None and no flattened fields passed, work.
@@ -1966,9 +1946,8 @@ async def test_update_instance_flattened_error_async():
1966
1946
)
1967
1947
1968
1948
1969
- def test_restart_instance (
1970
- transport : str = "grpc" , request_type = datafusion .RestartInstanceRequest
1971
- ):
1949
+ @pytest .mark .parametrize ("request_type" , [datafusion .RestartInstanceRequest , dict ,])
1950
+ def test_restart_instance (request_type , transport : str = "grpc" ):
1972
1951
client = DataFusionClient (
1973
1952
credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
1974
1953
)
@@ -1992,10 +1971,6 @@ def test_restart_instance(
1992
1971
assert isinstance (response , future .Future )
1993
1972
1994
1973
1995
- def test_restart_instance_from_dict ():
1996
- test_restart_instance (request_type = dict )
1997
-
1998
-
1999
1974
def test_restart_instance_empty_call ():
2000
1975
# This test is a coverage failsafe to make sure that totally empty calls,
2001
1976
# i.e. request == None and no flattened fields passed, work.
@@ -2630,7 +2605,7 @@ def test_parse_common_location_path():
2630
2605
assert expected == actual
2631
2606
2632
2607
2633
- def test_client_withDEFAULT_CLIENT_INFO ():
2608
+ def test_client_with_default_client_info ():
2634
2609
client_info = gapic_v1 .client_info .ClientInfo ()
2635
2610
2636
2611
with mock .patch .object (
0 commit comments