"""Pytest fixtures for unit tests.""" import pytest @pytest.fixture def sample_s3_file_created_event(): """Sample returned event after S3 file is created.""" return { 'Records': [{ 'eventVersion': '2.0', 'eventSource': 'aws:s3', 'awsRegion': 'us-east-1', 'eventTime': '2018-10-17T15:03:00.350Z', 'eventName': 'ObjectCreated:Put', 'userIdentity': { 'principalId': 'AWS:AIDAJKRKRGFMAY4PZ63SY' }, 'requestParameters': { 'sourceIPAddress': '68.96.116.230' }, 'responseElements': { 'x-amz-request-id': 'A9B3003200DDB3CF', 'x-amz-id-2': 'mv7hdPQA+IxenbHeLYPyxTymYC476fn2DCzx' 'QtROtI9R3AbXtfNuUfP+tAvAdU7a5iuamIH8H7c=' }, 's3': { 's3SchemaVersion': '1.0', 'configurationId': 'spotify-internal-id:index.handler', 'bucket': { 'name': 'dev-backfill-spotify-internal-id', 'ownerIdentity': { 'principalId': 'A2C1PL85TBWITW' }, 'arn': 'arn:aws:s3:::dev-backfill-spotify-internal-id' }, 'object': { 'key': 'test_file.csv', 'size': 18, 'eTag': '880fa7070e6b8102b9c38fdb6ba1c59f', 'sequencer': '005BC74F244FE83C3A' } } }] } @pytest.fixture def sample_s3_filename_with_spaces(): """Sample returned event after S3 file with spaces is created.""" return { 'Records': [{ 'eventVersion': '2.0', 'eventSource': 'aws:s3', 'awsRegion': 'us-east-1', 'eventTime': '2018-10-17T15:03:00.350Z', 'eventName': 'ObjectCreated:Put', 'userIdentity': { 'principalId': 'AWS:AIDAJKRKRGFMAY4PZ63SY' }, 'requestParameters': { 'sourceIPAddress': '68.96.116.230' }, 'responseElements': { 'x-amz-request-id': 'A9B3003200DDB3CF', 'x-amz-id-2': 'mv7hdPQA+IxenbHeLYPyxTymYC476fn2DCzx' 'QtROtI9R3AbXtfNuUfP+tAvAdU7a5iuamIH8H7c=' }, 's3': { 's3SchemaVersion': '1.0', 'configurationId': 'spotify-internal-id-dev:index.handler', 'bucket': { 'name': 'dev-backfill-spotify-internal-id', 'ownerIdentity': { 'principalId': 'A2C1PL85TBWITW' }, 'arn': 'arn:aws:s3:::dev-backfill-spotify-internal-id' }, 'object': { 'key': 'Testing+something+new.csv', 'size': 18, 'eTag': '880fa7070e6b8102b9c38fdb6ba1c59f', 'sequencer': '005BC74F244FE83C3A' } } }] } @pytest.fixture def sample_data_to_ingest(): """Sample ingestion data that would come from Spotify CSV.""" return { 'upc': 194491464318, 'ean': 'None', 'date_inserted': '2019-10-09 00:16:09', 'countries': 'US', 'live_from': '2019-11-01 00:00:00', 'album_uri': '176huqxTNuGpfztpSCo1EP', 'product_id': 2714740, 'distribution_format_id': 1, 'project_id': 4257359, 'product_type_id': 1, 'context_type': 'digital', 'vendor_id': 12659, 'subaccount_id': 0, 'release_date': '2019-11-01', 'status': 'in_content', 'product_name': 'Kiwibalboa', 'deletions': 'N' }