@@ -278,6 +278,39 @@ def test_table_factory_with_prefix(self):
278278 def test_table_factory_with_ignored_prefix (self ):
279279 self ._table_factory_prefix_helper (use_prefix = False )
280280
281+ def test_tables (self ):
282+ from gcloud .bigtable .table import Table
283+
284+ table_name1 = 'table-name1'
285+ table_name2 = 'table-name2'
286+ cluster = _Cluster (list_tables_result = [
287+ Table (table_name1 , None ),
288+ Table (table_name2 , None ),
289+ ])
290+ connection = self ._makeOne (autoconnect = False , cluster = cluster )
291+ result = connection .tables ()
292+ self .assertEqual (result , [table_name1 , table_name2 ])
293+
294+ def test_tables_with_prefix (self ):
295+ from gcloud .bigtable .table import Table
296+
297+ table_prefix = 'prefix'
298+ table_prefix_separator = '<>'
299+ unprefixed_table_name1 = 'table-name1'
300+
301+ table_name1 = (table_prefix + table_prefix_separator +
302+ unprefixed_table_name1 )
303+ table_name2 = 'table-name2'
304+ cluster = _Cluster (list_tables_result = [
305+ Table (table_name1 , None ),
306+ Table (table_name2 , None ),
307+ ])
308+ connection = self ._makeOne (
309+ autoconnect = False , cluster = cluster , table_prefix = table_prefix ,
310+ table_prefix_separator = table_prefix_separator )
311+ result = connection .tables ()
312+ self .assertEqual (result , [unprefixed_table_name1 ])
313+
281314
282315class _Client (object ):
283316
@@ -316,3 +349,6 @@ def copy(self):
316349 return result
317350 else :
318351 return self
352+
353+ def list_tables (self ):
354+ return self .list_tables_result
0 commit comments