"""Lambda test module.""" from unittest.mock import MagicMock from unittest.mock import patch import src.index @patch('src.index.call_datadog_with_metric') @patch('src.index.boto3') @patch('src.index.get_dms_ids') def test_handler(mock_get_dms_ids, mock_boto3, mock_datadog): """Test handler.""" boto3_client_mock = MagicMock() boto3_client_mock.invoke.return_value = None mock_boto3.client.return_value = boto3_client_mock class LambdaContext: aws_request_id = '1234-1234' mock_get_dms_ids.return_value = [{ 'dms_master_master_id': 698, 'order_types': [ { 'order_type': 'release', 'batch_delivery': 'Y', 'third_party_credential_set_id': None, 'count_encoded': 1 }, { 'order_type': 'ringtone', 'batch_delivery': 'Y', 'third_party_credential_set_id': None, 'count_encoded': 0 } ] }] src.index.handler(None, LambdaContext) assert boto3_client_mock.invoke.call_count == 1