#NEWLINE# @ patch ( 'nefertari.elasticsearch.ES._bulk' ) #NEWLINE# @ patch ( 'nefertari.elasticsearch.ES.api.mget' ) #NEWLINE# def test_index_missing_documents_all_docs_found( self , mock_mget , mock_bulk ) : #NEWLINE# #INDENT# obj = es . ES ( 'Foo' , 'foondex' ) #NEWLINE# documents = [ { #NEWLINE# #INDENT# '_pk' : 1 , #NEWLINE# 'name' : 'foo' , #NEWLINE# #UNINDENT# } ] #NEWLINE# mock_mget . return_value = { #NEWLINE# #INDENT# 'docs' : [ { #NEWLINE# #INDENT# '_id' : '1' , #NEWLINE# 'name' : 'foo' , #NEWLINE# 'found' : True , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# obj . index_missing_documents ( documents ) #NEWLINE# mock_mget . assert_called_once_with ( index = 'foondex' , doc_type = 'Foo' , fields = [ '_id' ] , body = { #NEWLINE# #INDENT# 'ids' : [ 1 ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( not mock_bulk . called )