@@ -395,6 +395,62 @@ def test___ne__(self):
395395 column_family2 = self ._makeOne ('column_family_id2' , None )
396396 self .assertNotEqual (column_family1 , column_family2 )
397397
398+ def _update_test_helper (self , gc_rule = None ):
399+ from gcloud .bigtable ._generated import (
400+ bigtable_table_data_pb2 as data_pb2 )
401+ from gcloud .bigtable ._testing import _FakeStub
402+
403+ project_id = 'project-id'
404+ zone = 'zone'
405+ cluster_id = 'cluster-id'
406+ table_id = 'table-id'
407+ column_family_id = 'column-family-id'
408+ timeout_seconds = 28
409+ table_name = ('projects/' + project_id + '/zones/' + zone +
410+ '/clusters/' + cluster_id + '/tables/' + table_id )
411+ column_family_name = table_name + '/columnFamilies/' + column_family_id
412+
413+ client = _Client (timeout_seconds = timeout_seconds )
414+ table = _Table (table_name , client = client )
415+ column_family = self ._makeOne (column_family_id , table , gc_rule = gc_rule )
416+
417+ # Create request_pb
418+ if gc_rule is None :
419+ request_pb = data_pb2 .ColumnFamily (name = column_family_name )
420+ else :
421+ request_pb = data_pb2 .ColumnFamily (
422+ name = column_family_name ,
423+ gc_rule = gc_rule .to_pb (),
424+ )
425+
426+ # Create response_pb
427+ response_pb = data_pb2 .ColumnFamily ()
428+
429+ # Patch the stub used by the API method.
430+ client ._table_stub = stub = _FakeStub (response_pb )
431+
432+ # Create expected_result.
433+ expected_result = None # update() has no return value.
434+
435+ # Perform the method and check the result.
436+ self .assertEqual (stub .results , (response_pb ,))
437+ result = column_family .update ()
438+ self .assertEqual (stub .results , ())
439+ self .assertEqual (result , expected_result )
440+ self .assertEqual (stub .method_calls , [(
441+ 'UpdateColumnFamily' ,
442+ (request_pb , timeout_seconds ),
443+ {},
444+ )])
445+
446+ def test_update (self ):
447+ self ._update_test_helper (gc_rule = None )
448+
449+ def test_update_with_gc_rule (self ):
450+ from gcloud .bigtable .column_family import MaxVersionsGCRule
451+ gc_rule = MaxVersionsGCRule (1337 )
452+ self ._update_test_helper (gc_rule = gc_rule )
453+
398454 def test_delete (self ):
399455 from gcloud .bigtable ._generated import (
400456 bigtable_table_service_messages_pb2 as messages_pb2 )
0 commit comments