"""Test handle_purged_release handler.""" import os import pytest import xmltodict from ddex_ingester_common.constants.xmltodict import DDEX_LIST_FIELDS DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data',) # noqa def parse_xml_to_dict(xml): """Parse given XML file using xmltodict.parse().""" with open(os.path.join(DATA_DIR, xml)) as fd: return xmltodict.parse(fd.read(), force_list=DDEX_LIST_FIELDS) @pytest.fixture def awal_purged_ddex(): """DDEX fixture for AWAL Purged product.""" return parse_xml_to_dict('awal_ddex_document_takedown.xml') @pytest.fixture def awal_purged_state_machine(): """Fixture for AWAL state_machine.""" return { 'validate_product_retry_counter': 0, 'is_purged_release': True, 'key': 'awal_ddex/db_video_test/', 'bucket': 'qa-ddex-ingester', 'tracks': None, 'orchard_label': None, 'maintenance_owner': None, 'participants': None, 'execution_name': 'DB_purged_video_release_02', 'message_thread_id': 'G010003545560O_TOC', 'update_indicator': None, 'execution_start_time': '2022-06-07T09:46:39.987Z', 'state_machine_name': 'qa-awal-ingester-sfn', 'ingest_id': 241, 'product': { 'display_status': None, 'sale_start_date': None, 'display_artist_name': None, 'status': None, 'special_instructions': None, 'not_for_distribution': 'AWALNotOurDistribution', 'release_reference': None, 'genre_id': 2, 'subgenre_id': 997, 'product_id': None, 'product_name': 'Destan', 'subaccount_id': None, 'vendor_id': None, 'grid': 'ABC123', 'original_values': None, 'original_release_date': None, 'release_type': None, 'upc': '123', 'artwork': None, 'catalog_number': 'CATALOG123' }, 'ddex_provider': 'AWAL', 'deal_coordinators': None, 'video': None, 'project_id': None, 'message_id': '204100961', 'errors': None, 'correlation_id': '72c41de2-8698-4ba0-bd78-4cab92ebf91d', 'warnings': None, 'error_correction': None }