#NEWLINE# @ mock . patch ( 'simple_elasticsearch.mixins.Elasticsearch.delete' ) #NEWLINE# def test__index_delete( self , mock_delete ) : #NEWLINE# #INDENT# post = self . latest_post #NEWLINE# mock_delete . return_value = { #NEWLINE# #INDENT# 'acknowledged' : True , #NEWLINE# #UNINDENT# } #NEWLINE# result = BlogPost . index_delete ( None ) #NEWLINE# self . assertFalse ( result ) #NEWLINE# result = BlogPost . index_delete ( post ) #NEWLINE# self . assertTrue ( result ) #NEWLINE# mock_delete . assert_called_with ( 'blog' , 'posts' , post . pk , routing = 1 ) #NEWLINE# result = BlogPost . index_delete ( post , 'foo' ) #NEWLINE# self . assertTrue ( mock_delete ) #NEWLINE# mock_delete . assert_called_with ( 'foo' , 'posts' , post . pk , routing = 1 )