def test_process_msg_exception(self):
"""
Tests the process_msg function when an exception is raised.
"""
logging.disable(logging.NOTSET)
with patch('receiver.receiver.logging.getLogger', return_value=LOGGER):
with patch('receiver.receiver.json.loads', side_effect=Exception('foo')):
with LogCapture() as log_capture:
process_msg(**self.kwargs)
log_capture.check(
('receiver',
'ERROR',
'An error occurred while processing the message \'{"@uuid": "12345", '
'"collection": "elasticsearch.test_index.test_logs", "message": '
'"foobar"}\':\n'
' foo'),
)
评论列表
文章目录