#NEWLINE# def test_dispatch_operation_complete_rsync( self ) : #NEWLINE# #INDENT# rpc = db_replicator . ReplicatorRpc ( '/' , '/' , FakeBroker , False ) #NEWLINE# self . _patch ( patch . object , db_replicator , 'renamer' , ( lambda * args : True ) ) #NEWLINE# with patch ( 'swift.common.db_replicator.os' , new = mock . MagicMock ( wraps = os ) ) as mock_os : #NEWLINE# #INDENT# mock_os . path . exists . side_effect = [ False , True ] #NEWLINE# response = rpc . dispatch ( ( 'drive' , 'part' , 'hash' ) , [ 'complete_rsync' , 'arg1' , 'arg2' ] ) #NEWLINE# expected_calls = [ call ( '/part/ash/hash/hash.db' ) , call ( '/drive/tmp/arg1' ) ] #NEWLINE# self . assertEqual ( mock_os . path . exists . call_args_list , expected_calls ) #NEWLINE# self . assertEqual ( '204 No Content' , response . status ) #NEWLINE# self . assertEqual ( 204 , response . status_int )