@@ -177,6 +177,33 @@ def test_batch(self):
177177 with self .assertRaises (NotImplementedError ):
178178 table .batch ()
179179
180+ def test_batch (self ):
181+ from gcloud ._testing import _Monkey
182+ from gcloud .bigtable .happybase import table as MUT
183+
184+ name = 'table-name'
185+ connection = None
186+ table = self ._makeOne (name , connection )
187+
188+ timestamp = object ()
189+ batch_size = 42
190+ transaction = False # Must be False when batch_size is non-null
191+ wal = object ()
192+
193+ with _Monkey (MUT , Batch = _MockBatch ):
194+ result = table .batch (timestamp = timestamp , batch_size = batch_size ,
195+ transaction = transaction , wal = wal )
196+
197+ self .assertTrue (isinstance (result , _MockBatch ))
198+ self .assertEqual (result .args , (table ,))
199+ expected_kwargs = {
200+ 'timestamp' : timestamp ,
201+ 'batch_size' : batch_size ,
202+ 'transaction' : transaction ,
203+ 'wal' : wal ,
204+ }
205+ self .assertEqual (result .kwargs , expected_kwargs )
206+
180207 def test_counter_get (self ):
181208 klass = self ._getTargetClass ()
182209 counter_value = 1337
@@ -470,3 +497,10 @@ def increment_cell_value(self, column_family_id, column, int_value):
470497
471498 def commit_modifications (self ):
472499 return self .commit_result
500+
501+
502+ class _MockBatch (object ):
503+
504+ def __init__ (self , * args , ** kwargs ):
505+ self .args = args
506+ self .kwargs = kwargs
0 commit comments