#NEWLINE# @ patch ( 'nefertari.elasticsearch.ES.api.search' ) #NEWLINE# def test_get_collection_no_index_not_raise( self , mock_search ) : #NEWLINE# #INDENT# obj = es . ES ( 'Foo' , 'foondex' ) #NEWLINE# mock_search . side_effect = es . IndexNotFoundException ( ) #NEWLINE# try : #NEWLINE# #INDENT# docs = obj . get_collection ( body = { #NEWLINE# #INDENT# 'foo' : 'bar' , #NEWLINE# #UNINDENT# } , _raise_on_empty = False , from_ = 0 ) #NEWLINE# #UNINDENT# except JHTTPNotFound : #NEWLINE# #INDENT# raise Exception ( 'Unexpected error' ) #NEWLINE# #UNINDENT# assert ( len ( mock_search ) == 0 )