@@ -240,20 +240,20 @@ def test_publisher_client_client_options(client_class, transport_class, transpor
240240 # unsupported value.
241241 with mock .patch .dict (os .environ , {"GOOGLE_API_USE_MTLS_ENDPOINT" : "Unsupported" }):
242242 with pytest .raises (MutualTLSChannelError ):
243- client = client_class ()
243+ client = client_class (transport = transport_name )
244244
245245 # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value.
246246 with mock .patch .dict (
247247 os .environ , {"GOOGLE_API_USE_CLIENT_CERTIFICATE" : "Unsupported" }
248248 ):
249249 with pytest .raises (ValueError ):
250- client = client_class ()
250+ client = client_class (transport = transport_name )
251251
252252 # Check the case quota_project_id is provided
253253 options = client_options .ClientOptions (quota_project_id = "octopus" )
254254 with mock .patch .object (transport_class , "__init__" ) as patched :
255255 patched .return_value = None
256- client = client_class (transport = transport_name , client_options = options )
256+ client = client_class (client_options = options , transport = transport_name )
257257 patched .assert_called_once_with (
258258 credentials = None ,
259259 credentials_file = None ,
@@ -310,7 +310,7 @@ def test_publisher_client_mtls_env_auto(
310310 )
311311 with mock .patch .object (transport_class , "__init__" ) as patched :
312312 patched .return_value = None
313- client = client_class (transport = transport_name , client_options = options )
313+ client = client_class (client_options = options , transport = transport_name )
314314
315315 if use_client_cert_env == "false" :
316316 expected_client_cert_source = None
@@ -405,7 +405,7 @@ def test_publisher_client_client_options_scopes(
405405 options = client_options .ClientOptions (scopes = ["1" , "2" ],)
406406 with mock .patch .object (transport_class , "__init__" ) as patched :
407407 patched .return_value = None
408- client = client_class (transport = transport_name , client_options = options )
408+ client = client_class (client_options = options , transport = transport_name )
409409 patched .assert_called_once_with (
410410 credentials = None ,
411411 credentials_file = None ,
@@ -436,7 +436,7 @@ def test_publisher_client_client_options_credentials_file(
436436 options = client_options .ClientOptions (credentials_file = "credentials.json" )
437437 with mock .patch .object (transport_class , "__init__" ) as patched :
438438 patched .return_value = None
439- client = client_class (transport = transport_name , client_options = options )
439+ client = client_class (client_options = options , transport = transport_name )
440440 patched .assert_called_once_with (
441441 credentials = None ,
442442 credentials_file = "credentials.json" ,
@@ -467,7 +467,8 @@ def test_publisher_client_client_options_from_dict():
467467 )
468468
469469
470- def test_create_topic (transport : str = "grpc" , request_type = pubsub .Topic ):
470+ @pytest .mark .parametrize ("request_type" , [pubsub .Topic , dict ,])
471+ def test_create_topic (request_type , transport : str = "grpc" ):
471472 client = PublisherClient (
472473 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
473474 )
@@ -496,10 +497,6 @@ def test_create_topic(transport: str = "grpc", request_type=pubsub.Topic):
496497 assert response .satisfies_pzs is True
497498
498499
499- def test_create_topic_from_dict ():
500- test_create_topic (request_type = dict )
501-
502-
503500def test_create_topic_empty_call ():
504501 # This test is a coverage failsafe to make sure that totally empty calls,
505502 # i.e. request == None and no flattened fields passed, work.
@@ -671,7 +668,8 @@ async def test_create_topic_flattened_error_async():
671668 )
672669
673670
674- def test_update_topic (transport : str = "grpc" , request_type = pubsub .UpdateTopicRequest ):
671+ @pytest .mark .parametrize ("request_type" , [pubsub .UpdateTopicRequest , dict ,])
672+ def test_update_topic (request_type , transport : str = "grpc" ):
675673 client = PublisherClient (
676674 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
677675 )
@@ -700,10 +698,6 @@ def test_update_topic(transport: str = "grpc", request_type=pubsub.UpdateTopicRe
700698 assert response .satisfies_pzs is True
701699
702700
703- def test_update_topic_from_dict ():
704- test_update_topic (request_type = dict )
705-
706-
707701def test_update_topic_empty_call ():
708702 # This test is a coverage failsafe to make sure that totally empty calls,
709703 # i.e. request == None and no flattened fields passed, work.
@@ -809,7 +803,8 @@ async def test_update_topic_field_headers_async():
809803 assert ("x-goog-request-params" , "topic.name=topic.name/value" ,) in kw ["metadata" ]
810804
811805
812- def test_publish (transport : str = "grpc" , request_type = pubsub .PublishRequest ):
806+ @pytest .mark .parametrize ("request_type" , [pubsub .PublishRequest , dict ,])
807+ def test_publish (request_type , transport : str = "grpc" ):
813808 client = PublisherClient (
814809 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
815810 )
@@ -834,10 +829,6 @@ def test_publish(transport: str = "grpc", request_type=pubsub.PublishRequest):
834829 assert response .message_ids == ["message_ids_value" ]
835830
836831
837- def test_publish_from_dict ():
838- test_publish (request_type = dict )
839-
840-
841832def test_publish_empty_call ():
842833 # This test is a coverage failsafe to make sure that totally empty calls,
843834 # i.e. request == None and no flattened fields passed, work.
@@ -1021,7 +1012,8 @@ async def test_publish_flattened_error_async():
10211012 )
10221013
10231014
1024- def test_get_topic (transport : str = "grpc" , request_type = pubsub .GetTopicRequest ):
1015+ @pytest .mark .parametrize ("request_type" , [pubsub .GetTopicRequest , dict ,])
1016+ def test_get_topic (request_type , transport : str = "grpc" ):
10251017 client = PublisherClient (
10261018 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
10271019 )
@@ -1050,10 +1042,6 @@ def test_get_topic(transport: str = "grpc", request_type=pubsub.GetTopicRequest)
10501042 assert response .satisfies_pzs is True
10511043
10521044
1053- def test_get_topic_from_dict ():
1054- test_get_topic (request_type = dict )
1055-
1056-
10571045def test_get_topic_empty_call ():
10581046 # This test is a coverage failsafe to make sure that totally empty calls,
10591047 # i.e. request == None and no flattened fields passed, work.
@@ -1225,7 +1213,8 @@ async def test_get_topic_flattened_error_async():
12251213 )
12261214
12271215
1228- def test_list_topics (transport : str = "grpc" , request_type = pubsub .ListTopicsRequest ):
1216+ @pytest .mark .parametrize ("request_type" , [pubsub .ListTopicsRequest , dict ,])
1217+ def test_list_topics (request_type , transport : str = "grpc" ):
12291218 client = PublisherClient (
12301219 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
12311220 )
@@ -1252,10 +1241,6 @@ def test_list_topics(transport: str = "grpc", request_type=pubsub.ListTopicsRequ
12521241 assert response .next_page_token == "next_page_token_value"
12531242
12541243
1255- def test_list_topics_from_dict ():
1256- test_list_topics (request_type = dict )
1257-
1258-
12591244def test_list_topics_empty_call ():
12601245 # This test is a coverage failsafe to make sure that totally empty calls,
12611246 # i.e. request == None and no flattened fields passed, work.
@@ -1425,8 +1410,10 @@ async def test_list_topics_flattened_error_async():
14251410 )
14261411
14271412
1428- def test_list_topics_pager ():
1429- client = PublisherClient (credentials = ga_credentials .AnonymousCredentials ,)
1413+ def test_list_topics_pager (transport_name : str = "grpc" ):
1414+ client = PublisherClient (
1415+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
1416+ )
14301417
14311418 # Mock the actual call within the gRPC stub, and fake the request.
14321419 with mock .patch .object (type (client .transport .list_topics ), "__call__" ) as call :
@@ -1455,8 +1442,10 @@ def test_list_topics_pager():
14551442 assert all (isinstance (i , pubsub .Topic ) for i in results )
14561443
14571444
1458- def test_list_topics_pages ():
1459- client = PublisherClient (credentials = ga_credentials .AnonymousCredentials ,)
1445+ def test_list_topics_pages (transport_name : str = "grpc" ):
1446+ client = PublisherClient (
1447+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
1448+ )
14601449
14611450 # Mock the actual call within the gRPC stub, and fake the request.
14621451 with mock .patch .object (type (client .transport .list_topics ), "__call__" ) as call :
@@ -1531,9 +1520,8 @@ async def test_list_topics_async_pages():
15311520 assert page_ .raw_page .next_page_token == token
15321521
15331522
1534- def test_list_topic_subscriptions (
1535- transport : str = "grpc" , request_type = pubsub .ListTopicSubscriptionsRequest
1536- ):
1523+ @pytest .mark .parametrize ("request_type" , [pubsub .ListTopicSubscriptionsRequest , dict ,])
1524+ def test_list_topic_subscriptions (request_type , transport : str = "grpc" ):
15371525 client = PublisherClient (
15381526 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
15391527 )
@@ -1564,10 +1552,6 @@ def test_list_topic_subscriptions(
15641552 assert response .next_page_token == "next_page_token_value"
15651553
15661554
1567- def test_list_topic_subscriptions_from_dict ():
1568- test_list_topic_subscriptions (request_type = dict )
1569-
1570-
15711555def test_list_topic_subscriptions_empty_call ():
15721556 # This test is a coverage failsafe to make sure that totally empty calls,
15731557 # i.e. request == None and no flattened fields passed, work.
@@ -1753,8 +1737,10 @@ async def test_list_topic_subscriptions_flattened_error_async():
17531737 )
17541738
17551739
1756- def test_list_topic_subscriptions_pager ():
1757- client = PublisherClient (credentials = ga_credentials .AnonymousCredentials ,)
1740+ def test_list_topic_subscriptions_pager (transport_name : str = "grpc" ):
1741+ client = PublisherClient (
1742+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
1743+ )
17581744
17591745 # Mock the actual call within the gRPC stub, and fake the request.
17601746 with mock .patch .object (
@@ -1788,8 +1774,10 @@ def test_list_topic_subscriptions_pager():
17881774 assert all (isinstance (i , str ) for i in results )
17891775
17901776
1791- def test_list_topic_subscriptions_pages ():
1792- client = PublisherClient (credentials = ga_credentials .AnonymousCredentials ,)
1777+ def test_list_topic_subscriptions_pages (transport_name : str = "grpc" ):
1778+ client = PublisherClient (
1779+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
1780+ )
17931781
17941782 # Mock the actual call within the gRPC stub, and fake the request.
17951783 with mock .patch .object (
@@ -1879,9 +1867,8 @@ async def test_list_topic_subscriptions_async_pages():
18791867 assert page_ .raw_page .next_page_token == token
18801868
18811869
1882- def test_list_topic_snapshots (
1883- transport : str = "grpc" , request_type = pubsub .ListTopicSnapshotsRequest
1884- ):
1870+ @pytest .mark .parametrize ("request_type" , [pubsub .ListTopicSnapshotsRequest , dict ,])
1871+ def test_list_topic_snapshots (request_type , transport : str = "grpc" ):
18851872 client = PublisherClient (
18861873 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
18871874 )
@@ -1911,10 +1898,6 @@ def test_list_topic_snapshots(
19111898 assert response .next_page_token == "next_page_token_value"
19121899
19131900
1914- def test_list_topic_snapshots_from_dict ():
1915- test_list_topic_snapshots (request_type = dict )
1916-
1917-
19181901def test_list_topic_snapshots_empty_call ():
19191902 # This test is a coverage failsafe to make sure that totally empty calls,
19201903 # i.e. request == None and no flattened fields passed, work.
@@ -2099,8 +2082,10 @@ async def test_list_topic_snapshots_flattened_error_async():
20992082 )
21002083
21012084
2102- def test_list_topic_snapshots_pager ():
2103- client = PublisherClient (credentials = ga_credentials .AnonymousCredentials ,)
2085+ def test_list_topic_snapshots_pager (transport_name : str = "grpc" ):
2086+ client = PublisherClient (
2087+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
2088+ )
21042089
21052090 # Mock the actual call within the gRPC stub, and fake the request.
21062091 with mock .patch .object (
@@ -2132,8 +2117,10 @@ def test_list_topic_snapshots_pager():
21322117 assert all (isinstance (i , str ) for i in results )
21332118
21342119
2135- def test_list_topic_snapshots_pages ():
2136- client = PublisherClient (credentials = ga_credentials .AnonymousCredentials ,)
2120+ def test_list_topic_snapshots_pages (transport_name : str = "grpc" ):
2121+ client = PublisherClient (
2122+ credentials = ga_credentials .AnonymousCredentials , transport = transport_name ,
2123+ )
21372124
21382125 # Mock the actual call within the gRPC stub, and fake the request.
21392126 with mock .patch .object (
@@ -2217,7 +2204,8 @@ async def test_list_topic_snapshots_async_pages():
22172204 assert page_ .raw_page .next_page_token == token
22182205
22192206
2220- def test_delete_topic (transport : str = "grpc" , request_type = pubsub .DeleteTopicRequest ):
2207+ @pytest .mark .parametrize ("request_type" , [pubsub .DeleteTopicRequest , dict ,])
2208+ def test_delete_topic (request_type , transport : str = "grpc" ):
22212209 client = PublisherClient (
22222210 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
22232211 )
@@ -2241,10 +2229,6 @@ def test_delete_topic(transport: str = "grpc", request_type=pubsub.DeleteTopicRe
22412229 assert response is None
22422230
22432231
2244- def test_delete_topic_from_dict ():
2245- test_delete_topic (request_type = dict )
2246-
2247-
22482232def test_delete_topic_empty_call ():
22492233 # This test is a coverage failsafe to make sure that totally empty calls,
22502234 # i.e. request == None and no flattened fields passed, work.
@@ -2407,9 +2391,8 @@ async def test_delete_topic_flattened_error_async():
24072391 )
24082392
24092393
2410- def test_detach_subscription (
2411- transport : str = "grpc" , request_type = pubsub .DetachSubscriptionRequest
2412- ):
2394+ @pytest .mark .parametrize ("request_type" , [pubsub .DetachSubscriptionRequest , dict ,])
2395+ def test_detach_subscription (request_type , transport : str = "grpc" ):
24132396 client = PublisherClient (
24142397 credentials = ga_credentials .AnonymousCredentials (), transport = transport ,
24152398 )
@@ -2435,10 +2418,6 @@ def test_detach_subscription(
24352418 assert isinstance (response , pubsub .DetachSubscriptionResponse )
24362419
24372420
2438- def test_detach_subscription_from_dict ():
2439- test_detach_subscription (request_type = dict )
2440-
2441-
24422421def test_detach_subscription_empty_call ():
24432422 # This test is a coverage failsafe to make sure that totally empty calls,
24442423 # i.e. request == None and no flattened fields passed, work.
@@ -3115,7 +3094,7 @@ def test_parse_common_location_path():
31153094 assert expected == actual
31163095
31173096
3118- def test_client_withDEFAULT_CLIENT_INFO ():
3097+ def test_client_with_default_client_info ():
31193098 client_info = gapic_v1 .client_info .ClientInfo ()
31203099
31213100 with mock .patch .object (
0 commit comments