"""Test handler.""" from unittest.mock import patch import index @patch('index.graphql_gateway.execute') def test_handler(mock_graphql_execute, payload): """Test the main handler.""" mock_graphql_execute.return_value = True response = index.handler(payload, None) assert response is True def test_parse_delivery_history(): """Test construct_item.""" data = index.parse_delivery_history( 'Spotify: 2020-11-11; iTunes: 2020-11-21', '245234523454' ) assert data == [ { 'storeId': 286, 'dateDelivered': '2020-11-11', 'encoderId': 25, 'upc': '245234523454', }, { 'storeId': 1, 'dateDelivered': '2020-11-21', 'encoderId': 25, 'upc': '245234523454', }, ]