def test_it_logs_NotFoundErrors(self, es, log): """NotFoundErrors from elasticsearch should be caught and logged.""" es.conn.delete.side_effect = elasticsearch.NotFoundError() index.delete(es, mock.Mock()) assert log.exception.called
def test_it_marks_annotation_as_deleted(self, es): index.delete(es, 'test_annotation_id') es.conn.index.assert_called_once_with(index='hypothesis', doc_type='annotation', body={'deleted': True}, id='test_annotation_id')
def delete_annotation(id_): delete(celery.request.es, id_) # If a reindex is running at the moment, delete annotation from the # new index as well. future_index = _current_reindex_new_name(celery.request) if future_index is not None: delete(celery.request.es, id_, target_index=future_index)
def test_it_deletes_the_annotation(self, es): index.delete(es, 'test_annotation_id') es.conn.delete.assert_called_once_with( index='hypothesis', doc_type='annotation', id='test_annotation_id', )
def test_it_marks_annotation_as_deleted(self, es): index.delete(es, 'test_annotation_id') es.conn.index.assert_called_once_with( index='hypothesis', doc_type='annotation', body={'deleted': True}, id='test_annotation_id' )
def test_it_allows_to_override_target_index(self, es): index.delete(es, 'test_annotation_id', target_index='custom-index') _, kwargs = es.conn.index.call_args assert kwargs['index'] == 'custom-index'
def delete_annotation(id_): delete(celery.request.es, id_)
def test_it_deletes_the_annotation(self, es): index.delete(es, "test_annotation_id") es.conn.delete.assert_called_once_with(index="hypothesis", doc_type="annotation", id="test_annotation_id")