#NEWLINE# @ mock . patch ( 'simple_elasticsearch.mixins.Elasticsearch.index' ) #NEWLINE# def test__should_index( self , mock_index ) : #NEWLINE# #INDENT# post = self . latest_post #NEWLINE# self . assertTrue ( BlogPost . should_index ( post ) ) #NEWLINE# mock_index . return_value = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# post = BlogPost . objects . get ( slug = 'DO-NOT-INDEX' ) #NEWLINE# self . assertFalse ( BlogPost . should_index ( self ) )