@@ -90,24 +90,26 @@ def test__get_default_mtls_endpoint():
9090
9191
9292@pytest .mark .parametrize (
93- "client_class" ,
93+ "client_class,transport_name " ,
9494 [
95- BetaAnalyticsDataClient ,
96- BetaAnalyticsDataAsyncClient ,
95+ ( BetaAnalyticsDataClient , "grpc" ) ,
96+ ( BetaAnalyticsDataAsyncClient , "grpc_asyncio" ) ,
9797 ],
9898)
99- def test_beta_analytics_data_client_from_service_account_info (client_class ):
99+ def test_beta_analytics_data_client_from_service_account_info (
100+ client_class , transport_name
101+ ):
100102 creds = ga_credentials .AnonymousCredentials ()
101103 with mock .patch .object (
102104 service_account .Credentials , "from_service_account_info"
103105 ) as factory :
104106 factory .return_value = creds
105107 info = {"valid" : True }
106- client = client_class .from_service_account_info (info )
108+ client = client_class .from_service_account_info (info , transport = transport_name )
107109 assert client .transport ._credentials == creds
108110 assert isinstance (client , client_class )
109111
110- assert client .transport ._host == "analyticsdata.googleapis.com:443"
112+ assert client .transport ._host == ( "analyticsdata.googleapis.com:443" )
111113
112114
113115@pytest .mark .parametrize (
@@ -136,27 +138,33 @@ def test_beta_analytics_data_client_service_account_always_use_jwt(
136138
137139
138140@pytest .mark .parametrize (
139- "client_class" ,
141+ "client_class,transport_name " ,
140142 [
141- BetaAnalyticsDataClient ,
142- BetaAnalyticsDataAsyncClient ,
143+ ( BetaAnalyticsDataClient , "grpc" ) ,
144+ ( BetaAnalyticsDataAsyncClient , "grpc_asyncio" ) ,
143145 ],
144146)
145- def test_beta_analytics_data_client_from_service_account_file (client_class ):
147+ def test_beta_analytics_data_client_from_service_account_file (
148+ client_class , transport_name
149+ ):
146150 creds = ga_credentials .AnonymousCredentials ()
147151 with mock .patch .object (
148152 service_account .Credentials , "from_service_account_file"
149153 ) as factory :
150154 factory .return_value = creds
151- client = client_class .from_service_account_file ("dummy/file/path.json" )
155+ client = client_class .from_service_account_file (
156+ "dummy/file/path.json" , transport = transport_name
157+ )
152158 assert client .transport ._credentials == creds
153159 assert isinstance (client , client_class )
154160
155- client = client_class .from_service_account_json ("dummy/file/path.json" )
161+ client = client_class .from_service_account_json (
162+ "dummy/file/path.json" , transport = transport_name
163+ )
156164 assert client .transport ._credentials == creds
157165 assert isinstance (client , client_class )
158166
159- assert client .transport ._host == "analyticsdata.googleapis.com:443"
167+ assert client .transport ._host == ( "analyticsdata.googleapis.com:443" )
160168
161169
162170def test_beta_analytics_data_client_get_transport_class ():
@@ -1929,6 +1937,19 @@ def test_transport_adc(transport_class):
19291937 adc .assert_called_once ()
19301938
19311939
1940+ @pytest .mark .parametrize (
1941+ "transport_name" ,
1942+ [
1943+ "grpc" ,
1944+ ],
1945+ )
1946+ def test_transport_kind (transport_name ):
1947+ transport = BetaAnalyticsDataClient .get_transport_class (transport_name )(
1948+ credentials = ga_credentials .AnonymousCredentials (),
1949+ )
1950+ assert transport .kind == transport_name
1951+
1952+
19321953def test_transport_grpc_default ():
19331954 # A client should use the gRPC transport by default.
19341955 client = BetaAnalyticsDataClient (
@@ -1977,6 +1998,14 @@ def test_beta_analytics_data_base_transport():
19771998 with pytest .raises (NotImplementedError ):
19781999 transport .close ()
19792000
2001+ # Catch all for all remaining methods and properties
2002+ remainder = [
2003+ "kind" ,
2004+ ]
2005+ for r in remainder :
2006+ with pytest .raises (NotImplementedError ):
2007+ getattr (transport , r )()
2008+
19802009
19812010def test_beta_analytics_data_base_transport_with_credentials_file ():
19822011 # Instantiate the base transport with a credentials file
@@ -2136,24 +2165,40 @@ def test_beta_analytics_data_grpc_transport_client_cert_source_for_mtls(
21362165 )
21372166
21382167
2139- def test_beta_analytics_data_host_no_port ():
2168+ @pytest .mark .parametrize (
2169+ "transport_name" ,
2170+ [
2171+ "grpc" ,
2172+ "grpc_asyncio" ,
2173+ ],
2174+ )
2175+ def test_beta_analytics_data_host_no_port (transport_name ):
21402176 client = BetaAnalyticsDataClient (
21412177 credentials = ga_credentials .AnonymousCredentials (),
21422178 client_options = client_options .ClientOptions (
21432179 api_endpoint = "analyticsdata.googleapis.com"
21442180 ),
2181+ transport = transport_name ,
21452182 )
2146- assert client .transport ._host == "analyticsdata.googleapis.com:443"
2183+ assert client .transport ._host == ( "analyticsdata.googleapis.com:443" )
21472184
21482185
2149- def test_beta_analytics_data_host_with_port ():
2186+ @pytest .mark .parametrize (
2187+ "transport_name" ,
2188+ [
2189+ "grpc" ,
2190+ "grpc_asyncio" ,
2191+ ],
2192+ )
2193+ def test_beta_analytics_data_host_with_port (transport_name ):
21502194 client = BetaAnalyticsDataClient (
21512195 credentials = ga_credentials .AnonymousCredentials (),
21522196 client_options = client_options .ClientOptions (
21532197 api_endpoint = "analyticsdata.googleapis.com:8000"
21542198 ),
2199+ transport = transport_name ,
21552200 )
2156- assert client .transport ._host == "analyticsdata.googleapis.com:8000"
2201+ assert client .transport ._host == ( "analyticsdata.googleapis.com:8000" )
21572202
21582203
21592204def test_beta_analytics_data_grpc_transport_channel ():
0 commit comments