@@ -260,20 +260,20 @@ def test_firestore_admin_client_client_options(
260260 # unsupported value.
261261 with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
262262 with pytest .raises (MutualTLSChannelError ):
263- client = client_class ()
263+ client = client_class (transport = transport_name )
264264
265265 # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
266266 with mock .patch .dict (
267267 os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
268268 ):
269269 with pytest .raises (ValueError ):
270- client = client_class ()
270+ client = client_class (transport = transport_name )
271271
272272 # Check the case quota_project_id is provided
273273 options = client_options .ClientOptions (quota_project_id = "octopus" )
274274 with mock .patch .object (transport_class , "__init__" ) as patched :
275275 patched .return_value = None
276- client = client_class (transport = transport_name , client_options = options )
276+ client = client_class (client_options = options , transport = transport_name )
277277 patched .assert_called_once_with (
278278 credentials = None ,
279279 credentials_file = None ,
@@ -332,7 +332,7 @@ def test_firestore_admin_client_mtls_env_auto(
332332 )
333333 with mock .patch .object (transport_class , "__init__" ) as patched :
334334 patched .return_value = None
335- client = client_class (transport = transport_name , client_options = options )
335+ client = client_class (client_options = options , transport = transport_name )
336336
337337 if use_client_cert_env == "false" :
338338 expected_client_cert_source = None
@@ -427,7 +427,7 @@ def test_firestore_admin_client_client_options_scopes(
427427 options = client_options .ClientOptions (scopes = ["1" , "2" ],)
428428 with mock .patch .object (transport_class , "__init__" ) as patched :
429429 patched .return_value = None
430- client = client_class (transport = transport_name , client_options = options )
430+ client = client_class (client_options = options , transport = transport_name )
431431 patched .assert_called_once_with (
432432 credentials = None ,
433433 credentials_file = None ,
@@ -458,7 +458,7 @@ def test_firestore_admin_client_client_options_credentials_file(
458458 options = client_options .ClientOptions (credentials_file = "credentials.json" )
459459 with mock .patch .object (transport_class , "__init__" ) as patched :
460460 patched .return_value = None
461- client = client_class (transport = transport_name , client_options = options )
461+ client = client_class (client_options = options , transport = transport_name )
462462 patched .assert_called_once_with (
463463 credentials = None ,
464464 credentials_file = "credentials.json" ,
@@ -491,9 +491,8 @@ def test_firestore_admin_client_client_options_from_dict():
491491 )
492492
493493
494- def test_create_index (
495- transport : str = "grpc" , request_type = firestore_admin .CreateIndexRequest
496- ):
494+ @pytest .mark .parametrize ("request_type" , [firestore_admin .CreateIndexRequest , dict ,])
495+ def test_create_index (request_type , transport : str = "grpc" ):
497496 client = FirestoreAdminClient (
498497 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
499498 )
@@ -517,10 +516,6 @@ def test_create_index(
517516 assert isinstance (response , future .Future )
518517
519518
520- def test_create_index_from_dict ():
521- test_create_index (request_type = dict )
522-
523-
524519def test_create_index_empty_call ():
525520 # This test is a coverage failsafe to make sure that totally empty calls,
526521 # i.e. request == None and no flattened fields passed, work.
@@ -709,9 +704,8 @@ async def test_create_index_flattened_error_async():
709704 )
710705
711706
712- def test_list_indexes (
713- transport : str = "grpc" , request_type = firestore_admin .ListIndexesRequest
714- ):
707+ @pytest .mark .parametrize ("request_type" , [firestore_admin .ListIndexesRequest , dict ,])
708+ def test_list_indexes (request_type , transport : str = "grpc" ):
715709 client = FirestoreAdminClient (
716710 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
717711 )
@@ -738,10 +732,6 @@ def test_list_indexes(
738732 assert response .next_page_token == "next_page_token_value"
739733
740734
741- def test_list_indexes_from_dict ():
742- test_list_indexes (request_type = dict )
743-
744-
745735def test_list_indexes_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.
@@ -919,8 +909,10 @@ async def test_list_indexes_flattened_error_async():
919909 )
920910
921911
922- def test_list_indexes_pager ():
923- client = FirestoreAdminClient (credentials = ga_credentials .AnonymousCredentials ,)
912+ def test_list_indexes_pager (transport_name : str = "grpc" ):
913+ client = FirestoreAdminClient (
914+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
915+ )
924916
925917 # Mock the actual call within the gRPC stub, and fake the request.
926918 with mock .patch .object (type (client .transport .list_indexes ), "__call__" ) as call :
@@ -953,8 +945,10 @@ def test_list_indexes_pager():
953945 assert all (isinstance (i , index .Index ) for i in results )
954946
955947
956- def test_list_indexes_pages ():
957- client = FirestoreAdminClient (credentials = ga_credentials .AnonymousCredentials ,)
948+ def test_list_indexes_pages (transport_name : str = "grpc" ):
949+ client = FirestoreAdminClient (
950+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
951+ )
958952
959953 # Mock the actual call within the gRPC stub, and fake the request.
960954 with mock .patch .object (type (client .transport .list_indexes ), "__call__" ) as call :
@@ -1041,9 +1035,8 @@ async def test_list_indexes_async_pages():
10411035 assert page_ .raw_page .next_page_token == token
10421036
10431037
1044- def test_get_index (
1045- transport : str = "grpc" , request_type = firestore_admin .GetIndexRequest
1046- ):
1038+ @pytest .mark .parametrize ("request_type" , [firestore_admin .GetIndexRequest , dict ,])
1039+ def test_get_index (request_type , transport : str = "grpc" ):
10471040 client = FirestoreAdminClient (
10481041 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
10491042 )
@@ -1074,10 +1067,6 @@ def test_get_index(
10741067 assert response .state == index .Index .State .CREATING
10751068
10761069
1077- def test_get_index_from_dict ():
1078- test_get_index (request_type = dict )
1079-
1080-
10811070def test_get_index_empty_call ():
10821071 # This test is a coverage failsafe to make sure that totally empty calls,
10831072 # i.e. request == None and no flattened fields passed, work.
@@ -1255,9 +1244,8 @@ async def test_get_index_flattened_error_async():
12551244 )
12561245
12571246
1258- def test_delete_index (
1259- transport : str = "grpc" , request_type = firestore_admin .DeleteIndexRequest
1260- ):
1247+ @pytest .mark .parametrize ("request_type" , [firestore_admin .DeleteIndexRequest , dict ,])
1248+ def test_delete_index (request_type , transport : str = "grpc" ):
12611249 client = FirestoreAdminClient (
12621250 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
12631251 )
@@ -1281,10 +1269,6 @@ def test_delete_index(
12811269 assert response is None
12821270
12831271
1284- def test_delete_index_from_dict ():
1285- test_delete_index (request_type = dict )
1286-
1287-
12881272def test_delete_index_empty_call ():
12891273 # This test is a coverage failsafe to make sure that totally empty calls,
12901274 # i.e. request == None and no flattened fields passed, work.
@@ -1453,9 +1437,8 @@ async def test_delete_index_flattened_error_async():
14531437 )
14541438
14551439
1456- def test_get_field (
1457- transport : str = "grpc" , request_type = firestore_admin .GetFieldRequest
1458- ):
1440+ @pytest .mark .parametrize ("request_type" , [firestore_admin .GetFieldRequest , dict ,])
1441+ def test_get_field (request_type , transport : str = "grpc" ):
14591442 client = FirestoreAdminClient (
14601443 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
14611444 )
@@ -1480,10 +1463,6 @@ def test_get_field(
14801463 assert response .name == "name_value"
14811464
14821465
1483- def test_get_field_from_dict ():
1484- test_get_field (request_type = dict )
1485-
1486-
14871466def test_get_field_empty_call ():
14881467 # This test is a coverage failsafe to make sure that totally empty calls,
14891468 # i.e. request == None and no flattened fields passed, work.
@@ -1655,9 +1634,8 @@ async def test_get_field_flattened_error_async():
16551634 )
16561635
16571636
1658- def test_update_field (
1659- transport : str = "grpc" , request_type = firestore_admin .UpdateFieldRequest
1660- ):
1637+ @pytest .mark .parametrize ("request_type" , [firestore_admin .UpdateFieldRequest , dict ,])
1638+ def test_update_field (request_type , transport : str = "grpc" ):
16611639 client = FirestoreAdminClient (
16621640 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
16631641 )
@@ -1681,10 +1659,6 @@ def test_update_field(
16811659 assert isinstance (response , future .Future )
16821660
16831661
1684- def test_update_field_from_dict ():
1685- test_update_field (request_type = dict )
1686-
1687-
16881662def test_update_field_empty_call ():
16891663 # This test is a coverage failsafe to make sure that totally empty calls,
16901664 # i.e. request == None and no flattened fields passed, work.
@@ -1861,9 +1835,8 @@ async def test_update_field_flattened_error_async():
18611835 )
18621836
18631837
1864- def test_list_fields (
1865- transport : str = "grpc" , request_type = firestore_admin .ListFieldsRequest
1866- ):
1838+ @pytest .mark .parametrize ("request_type" , [firestore_admin .ListFieldsRequest , dict ,])
1839+ def test_list_fields (request_type , transport : str = "grpc" ):
18671840 client = FirestoreAdminClient (
18681841 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
18691842 )
@@ -1890,10 +1863,6 @@ def test_list_fields(
18901863 assert response .next_page_token == "next_page_token_value"
18911864
18921865
1893- def test_list_fields_from_dict ():
1894- test_list_fields (request_type = dict )
1895-
1896-
18971866def test_list_fields_empty_call ():
18981867 # This test is a coverage failsafe to make sure that totally empty calls,
18991868 # i.e. request == None and no flattened fields passed, work.
@@ -2069,8 +2038,10 @@ async def test_list_fields_flattened_error_async():
20692038 )
20702039
20712040
2072- def test_list_fields_pager ():
2073- client = FirestoreAdminClient (credentials = ga_credentials .AnonymousCredentials ,)
2041+ def test_list_fields_pager (transport_name : str = "grpc" ):
2042+ client = FirestoreAdminClient (
2043+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
2044+ )
20742045
20752046 # Mock the actual call within the gRPC stub, and fake the request.
20762047 with mock .patch .object (type (client .transport .list_fields ), "__call__" ) as call :
@@ -2101,8 +2072,10 @@ def test_list_fields_pager():
21012072 assert all (isinstance (i , field .Field ) for i in results )
21022073
21032074
2104- def test_list_fields_pages ():
2105- client = FirestoreAdminClient (credentials = ga_credentials .AnonymousCredentials ,)
2075+ def test_list_fields_pages (transport_name : str = "grpc" ):
2076+ client = FirestoreAdminClient (
2077+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
2078+ )
21062079
21072080 # Mock the actual call within the gRPC stub, and fake the request.
21082081 with mock .patch .object (type (client .transport .list_fields ), "__call__" ) as call :
@@ -2183,9 +2156,10 @@ async def test_list_fields_async_pages():
21832156 assert page_ .raw_page .next_page_token == token
21842157
21852158
2186- def test_export_documents (
2187- transport : str = "grpc" , request_type = firestore_admin .ExportDocumentsRequest
2188- ):
2159+ @pytest .mark .parametrize (
2160+ "request_type" , [firestore_admin .ExportDocumentsRequest , dict ,]
2161+ )
2162+ def test_export_documents (request_type , transport : str = "grpc" ):
21892163 client = FirestoreAdminClient (
21902164 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
21912165 )
@@ -2209,10 +2183,6 @@ def test_export_documents(
22092183 assert isinstance (response , future .Future )
22102184
22112185
2212- def test_export_documents_from_dict ():
2213- test_export_documents (request_type = dict )
2214-
2215-
22162186def test_export_documents_empty_call ():
22172187 # This test is a coverage failsafe to make sure that totally empty calls,
22182188 # i.e. request == None and no flattened fields passed, work.
@@ -2387,9 +2357,10 @@ async def test_export_documents_flattened_error_async():
23872357 )
23882358
23892359
2390- def test_import_documents (
2391- transport : str = "grpc" , request_type = firestore_admin .ImportDocumentsRequest
2392- ):
2360+ @pytest .mark .parametrize (
2361+ "request_type" , [firestore_admin .ImportDocumentsRequest , dict ,]
2362+ )
2363+ def test_import_documents (request_type , transport : str = "grpc" ):
23932364 client = FirestoreAdminClient (
23942365 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
23952366 )
@@ -2413,10 +2384,6 @@ def test_import_documents(
24132384 assert isinstance (response , future .Future )
24142385
24152386
2416- def test_import_documents_from_dict ():
2417- test_import_documents (request_type = dict )
2418-
2419-
24202387def test_import_documents_empty_call ():
24212388 # This test is a coverage failsafe to make sure that totally empty calls,
24222389 # i.e. request == None and no flattened fields passed, work.
@@ -3230,7 +3197,7 @@ def test_parse_common_location_path():
32303197 assert expected == actual
32313198
32323199
3233- def test_client_withDEFAULT_CLIENT_INFO ():
3200+ def test_client_with_default_client_info ():
32343201 client_info = gapic_v1 .client_info .ClientInfo ()
32353202
32363203 with mock .patch .object (
0 commit comments