@@ -31,14 +31,16 @@ def test_wo_emulator(self):
3131 credentials = _make_credentials ()
3232 client = _Client (credentials )
3333 client_info = client ._client_info = mock .Mock ()
34+ transport = mock .Mock ()
3435
35- result = self ._invoke_client_factory (client_class )(client )
36+ result = self ._invoke_client_factory (client_class , transport = transport )(client )
3637
3738 self .assertIs (result , client_class .return_value )
3839 client_class .assert_called_once_with (
39- credentials = client . _credentials ,
40+ credentials = None ,
4041 client_info = client_info ,
4142 client_options = None ,
43+ transport = transport ,
4244 )
4345
4446 def test_wo_emulator_w_client_options (self ):
@@ -47,16 +49,18 @@ def test_wo_emulator_w_client_options(self):
4749 client = _Client (credentials )
4850 client_info = client ._client_info = mock .Mock ()
4951 client_options = mock .Mock ()
52+ transport = mock .Mock ()
5053
5154 result = self ._invoke_client_factory (
52- client_class , client_options = client_options
55+ client_class , client_options = client_options , transport = transport
5356 )(client )
5457
5558 self .assertIs (result , client_class .return_value )
5659 client_class .assert_called_once_with (
57- credentials = client . _credentials ,
60+ credentials = None ,
5861 client_info = client_info ,
5962 client_options = client_options ,
63+ transport = transport ,
6064 )
6165
6266 def test_w_emulator (self ):
@@ -170,7 +174,13 @@ def test_constructor_with_emulator_host(self):
170174
171175 self .assertEqual (client ._emulator_host , emulator_host )
172176 self .assertIs (client ._emulator_channel , factory .return_value )
173- factory .assert_called_once_with (emulator_host )
177+ factory .assert_called_once_with (
178+ target = emulator_host ,
179+ options = {
180+ "grpc.keepalive_time_ms" : 30000 ,
181+ "grpc.keepalive_timeout_ms" : 10000 ,
182+ }.items (),
183+ )
174184 getenv .assert_called_once_with (BIGTABLE_EMULATOR )
175185
176186 def test__get_scopes_default (self ):
@@ -234,7 +244,9 @@ def test_table_data_client_not_initialized_w_client_options(self):
234244 from google .api_core .client_options import ClientOptions
235245
236246 credentials = _make_credentials ()
237- client_options = ClientOptions (quota_project_id = "QUOTA-PROJECT" )
247+ client_options = ClientOptions (
248+ quota_project_id = "QUOTA-PROJECT" , api_endpoint = "xyz"
249+ )
238250 client = self ._make_one (
239251 project = self .PROJECT , credentials = credentials , client_options = client_options
240252 )
@@ -245,9 +257,11 @@ def test_table_data_client_not_initialized_w_client_options(self):
245257
246258 self .assertIs (table_data_client , mocked .return_value )
247259 self .assertIs (client ._table_data_client , table_data_client )
260+
248261 mocked .assert_called_once_with (
249262 client_info = client ._client_info ,
250- credentials = mock .ANY , # added scopes
263+ credentials = None ,
264+ transport = mock .ANY ,
251265 client_options = client_options ,
252266 )
253267
@@ -308,6 +322,7 @@ def test_table_admin_client_not_initialized_w_client_options(self):
308322 admin_client_options = admin_client_options ,
309323 )
310324
325+ client ._create_gapic_client_channel = mock .Mock ()
311326 patch = mock .patch ("google.cloud.bigtable_admin_v2.BigtableTableAdminClient" )
312327 with patch as mocked :
313328 table_admin_client = client .table_admin_client
@@ -316,7 +331,8 @@ def test_table_admin_client_not_initialized_w_client_options(self):
316331 self .assertIs (client ._table_admin_client , table_admin_client )
317332 mocked .assert_called_once_with (
318333 client_info = client ._client_info ,
319- credentials = mock .ANY , # added scopes
334+ credentials = None ,
335+ transport = mock .ANY ,
320336 client_options = admin_client_options ,
321337 )
322338
@@ -377,6 +393,7 @@ def test_instance_admin_client_not_initialized_w_client_options(self):
377393 admin_client_options = admin_client_options ,
378394 )
379395
396+ client ._create_gapic_client_channel = mock .Mock ()
380397 patch = mock .patch ("google.cloud.bigtable_admin_v2.BigtableInstanceAdminClient" )
381398 with patch as mocked :
382399 instance_admin_client = client .instance_admin_client
@@ -385,7 +402,8 @@ def test_instance_admin_client_not_initialized_w_client_options(self):
385402 self .assertIs (client ._instance_admin_client , instance_admin_client )
386403 mocked .assert_called_once_with (
387404 client_info = client ._client_info ,
388- credentials = mock .ANY , # added scopes
405+ credentials = None ,
406+ transport = mock .ANY ,
389407 client_options = admin_client_options ,
390408 )
391409
0 commit comments