import json import pytest from freezegun import freeze_time from datetime import datetime, timezone from slz_appreciationengine_scrapper import config from slz_appreciationengine_scrapper.dsp.entities import S3 @pytest.fixture def params(): params = config.App.empty() params.environment = 'test_env' params.s3 = S3( archive='bucket-archive', archive_quarantine='bucket-archive-quarantine', decompressed='bucket-decompressed', decompressed_quarantine='bucket-decompressed-quarantine', corrupted='bucket-corrupted', ) params.aws = config.AWS( region='us-west-1', endpoint='', ) params.input = '{\"config_bucket\":\"test-config-bucket\"}' params.scrapper.max_retries = 1 return params @pytest.fixture def ae_mapping(s3_client): s3_client.create_bucket(Bucket='test-config-bucket') mapping = { "sme": { "US_Columbia": "Sony Music US - Columbia", "CenturyMediaRecords": "Sony Music - Century Media Records", "AU_NZ": "Sony Music Australia/New Zealand", }, "theorchard": { "UK": "The Orchard - UK", } } s3_client.put_object( Body=json.dumps(mapping), Bucket='test-config-bucket', Key='appreciationengine/mapping.json', ) return mapping @pytest.fixture(scope='function') def now(): with freeze_time(datetime(2021, 11, 24, 3, 21, 34, tzinfo=timezone.utc)): yield datetime.now().astimezone(timezone.utc)