Exemplo n.º 1
0
 def search(self, **kwargs):  # pylint: disable=arguments-differ
     """ this will definitely fail """
     raise exceptions.ElasticsearchException("This search operation failed")
Exemplo n.º 2
0
 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))
Exemplo n.º 3
0
 def log_indexing_error(cls, indexing_errors):
     """
     Logs indexing errors and raises a general ElasticSearch Exception
     """
     raise exceptions.ElasticsearchException(', '.join(map(str, indexing_errors)))
Exemplo n.º 4
0
 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"}])
Exemplo n.º 5
0
 def search(self, **kwargs):
     """ this will definitely fail """
     raise exceptions.ElasticsearchException("This search operation failed")
Exemplo n.º 6
0
 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"])