def search(self, **kwargs): # pylint: disable=arguments-differ """ this will definitely fail """ raise exceptions.ElasticsearchException("This search operation failed")
def log_indexing_error(cls, indexing_errors): """ Logs indexing errors and raises a general ElasticSearch Exception""" indexing_errors_log = [] for indexing_error in indexing_errors: indexing_errors_log.append(indexing_error.message) raise exceptions.ElasticsearchException(', '.join(indexing_errors_log))
def log_indexing_error(cls, indexing_errors): """ Logs indexing errors and raises a general ElasticSearch Exception """ raise exceptions.ElasticsearchException(', '.join(map(str, indexing_errors)))
def test_index_failure_bulk(self): """ the index operation should fail """ with patch('search.elastic.bulk', return_value=[0, [exceptions.ElasticsearchException()]]): with self.assertRaises(exceptions.ElasticsearchException): self.searcher.index([{"name": "abc test"}])
def search(self, **kwargs): """ this will definitely fail """ raise exceptions.ElasticsearchException("This search operation failed")
def test_remove_failure_bulk(self): """ the remove operation should fail """ with patch('search.elastic.bulk', return_value=[0, [exceptions.ElasticsearchException()]]): with self.assertRaises(exceptions.ElasticsearchException): self.searcher.remove("test_doc", ["test_id"])