# pylint: disable=redefined-outer-name, unused-argument import os import boto3 import pytest from boto3_type_annotations.s3 import Client as S3Client from moto import mock_s3 from slz_config.entities import DSPSettings from . import BUCKET_TEST @pytest.fixture(scope='function', autouse=True) def aws_credentials(): os.environ['AWS_ACCESS_KEY_ID'] = 'testing' os.environ['AWS_SECRET_ACCESS_KEY'] = 'testing' os.environ['AWS_SECURITY_TOKEN'] = 'testing' os.environ['AWS_SESSION_TOKEN'] = 'testing' os.environ['AWS_DEFAULT_REGION'] = 'us-east-1' boto3.setup_default_session( aws_access_key_id='testing', aws_secret_access_key='testing', aws_session_token='testing', region_name='us-east-1', ) @pytest.fixture def s3_client(aws_credentials): with mock_s3(): s3_client_: S3Client = boto3.client('s3') s3_client_.create_bucket(Bucket=BUCKET_TEST) yield s3_client_ s3_resource = boto3.resource('s3') bucket = s3_resource.Bucket(BUCKET_TEST) bucket.objects.all().delete() bucket.delete() @pytest.fixture def dsp_settings(): return DSPSettings.parse( { 'uow_active_days_limit': 30, 'default_priority_hrs': 24, 'implementations': [ { 'rule': 'sme/users', 'label': 'SpecificLicensorSpecificReport', 'flow': 'slow' }, { 'rule': 'sme/*', 'label': 'SpecificLicensor', }, { 'rule': '*/activity', 'label': 'SpecificReportType', 'flow': 'generic' }, { 'rule': '*/*', 'label': 'AnyClient', }, ], 'validation_thresholds': { 'low': 40, 'high': 50 } } )