def test_perform_request_error(self, mock_response):
     mock_response.return_value.status = 500
     connection = BotoHttpConnection(aws_access_key_id='access_key', aws_secret_access_key='secret')
     with self.assertRaises(ElasticsearchException):
         with patch('elasticsearch.connection.base.logger.debug') as mock_logger:
             connection.perform_request('get', 'http://example.com')
             self.assertGreater(mock_logger.call_count, 0)
Esempio n. 2
0
 def test_perform_request_error(self, mock_response):
     mock_response.return_value.status = 500
     connection = BotoHttpConnection(aws_access_key_id='access_key', aws_secret_access_key='secret')
     with self.assertRaises(ElasticsearchException):
         with patch('elasticsearch.connection.base.logger.debug') as mock_logger:
             connection.perform_request('get', 'http://example.com')
             self.assertGreater(mock_logger.call_count, 0)
 def test_perform_request_success(self, mock_response):
     mock_response.return_value.status = 200
     connection = BotoHttpConnection(aws_access_key_id='access_key', aws_secret_access_key='secret')
     with patch('elasticsearch.connection.base.logger.info') as mock_logger:
         status, _header, _data = connection.perform_request('get', 'http://example.com')
         self.assertEqual(status, 200)
         self.assertGreater(mock_logger.call_count, 0)
Esempio n. 4
0
 def test_perform_request_success(self, mock_response):
     mock_response.return_value.status = 200
     connection = BotoHttpConnection(aws_access_key_id='access_key', aws_secret_access_key='secret')
     with patch('elasticsearch.connection.base.logger.info') as mock_logger:
         status, _header, _data = connection.perform_request('get', 'http://example.com')
         self.assertEqual(status, 200)
         self.assertGreater(mock_logger.call_count, 0)