#NEWLINE# def test_sync_triggers_sync_store_update( self ) : #NEWLINE# #INDENT# klass = 'swift.container.sync_store.ContainerSyncStore' #NEWLINE# ts_iter = make_timestamp_iter ( ) #NEWLINE# broker_1 = self . _get_broker ( 'a' , 'c' , node_index = 0 ) #NEWLINE# broker_1 . initialize ( next ( ts_iter ) . internal , POLICIES . default . idx ) #NEWLINE# broker_2 = self . _get_broker ( 'b' , 'd' , node_index = 0 ) #NEWLINE# broker_2 . initialize ( next ( ts_iter ) . internal , POLICIES . default . idx ) #NEWLINE# broker_2 . update_metadata ( { #NEWLINE# #INDENT# 'X-Container-Sync-To' : ( 'a' , next ( ts_iter ) . internal ) , #NEWLINE# 'X-Container-Sync-Key' : ( 'secret' , next ( ts_iter ) . internal ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# ( part , node ) = self . _get_broker_part_node ( broker_1 ) #NEWLINE# with mock . patch ( ( klass + '.remove_synced_container' ) ) as mock_remove : #NEWLINE# #INDENT# with mock . patch ( ( klass + '.add_synced_container' ) ) as mock_add : #NEWLINE# #INDENT# self . _run_once ( node ) #NEWLINE# #UNINDENT# #UNINDENT# self . assertEqual ( 1 , mock_add . call_count ) #NEWLINE# self . assertEqual ( broker_2 . db_file , mock_add . call_args [ 0 ] [ 0 ] . db_file ) #NEWLINE# self . assertEqual ( 0 , mock_remove . call_count ) #NEWLINE# broker_2 . update_metadata ( { #NEWLINE# #INDENT# 'X-Container-Sync-To' : ( '' , next ( ts_iter ) . internal ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# ( part , node ) = self . _get_broker_part_node ( broker_2 ) #NEWLINE# with mock . patch ( ( klass + '.remove_synced_container' ) ) as mock_remove : #NEWLINE# #INDENT# with mock . patch ( ( klass + '.add_synced_container' ) ) as mock_add : #NEWLINE# #INDENT# self . _run_once ( node ) #NEWLINE# #UNINDENT# #UNINDENT# self . assertEqual ( 0 , mock_add . call_count ) #NEWLINE# self . assertEqual ( 1 , mock_remove . call_count ) #NEWLINE# self . assertEqual ( broker_2 . db_file , mock_remove . call_args [ 0 ] [ 0 ] . db_file )