#NEWLINE# def test_remove_device( self ) : #NEWLINE# #INDENT# for search_value in self . search_values : #NEWLINE# #INDENT# self . create_sample_ring ( ) #NEWLINE# argv = [ '' , self . tmpfile , 'remove' , search_value ] #NEWLINE# self . assertSystemExit ( EXIT_SUCCESS , ringbuilder . main , argv ) #NEWLINE# ring = RingBuilder . load ( self . tmpfile ) #NEWLINE# dev = ring . devs [ 0 ] #NEWLINE# self . assertEqual ( dev [ 'weight' ] , 0 ) #NEWLINE# self . assertEqual ( dev [ 'region' ] , 0 ) #NEWLINE# self . assertEqual ( dev [ 'zone' ] , 0 ) #NEWLINE# self . assertEqual ( dev [ 'ip' ] , '127.0.0.1' ) #NEWLINE# self . assertEqual ( dev [ 'port' ] , 6200 ) #NEWLINE# self . assertEqual ( dev [ 'device' ] , 'sda1' ) #NEWLINE# self . assertEqual ( dev [ 'weight' ] , 0 ) #NEWLINE# self . assertEqual ( dev [ 'replication_ip' ] , '127.0.0.1' ) #NEWLINE# self . assertEqual ( dev [ 'replication_port' ] , 6200 ) #NEWLINE# self . assertEqual ( dev [ 'meta' ] , 'some meta data' ) #NEWLINE# dev = ring . devs [ 1 ] #NEWLINE# self . assertEqual ( dev [ 'weight' ] , 100 ) #NEWLINE# self . assertFalse ( [ d for d in ring . _remove_devs if ( d [ 'id' ] == 1 ) ] ) #NEWLINE# ring . rebalance ( ) #NEWLINE# self . assertTrue ( ring . validate ( ) )