"""Lambda test module.""" from unittest.mock import patch import pytest from app import handler @patch('app.PaymentGenerationProcessor') def test_handler(mock_processor, mock_event): """Test handler function.""" result = handler(mock_event, None) assert result == {'status': 'OK'} mock_processor.assert_called_once_with(mock_event) @patch('app.sentry_sdk') @patch('app.PaymentGenerationProcessor.process') def test_handler_exception(mock_processor, mock_capture_exception, mock_event): """Test handler catches Exception.""" mock_capture_exception.return_value = True mock_processor.side_effect = Exception('key error') with pytest.raises(Exception) as e: handler(mock_event, None) mock_capture_exception.assert_called_once_with(e)