"""Test setup.""" import os from dotenv import load_dotenv from moto import mock_aws import pytest load_dotenv() @pytest.fixture(scope='function') def aws_credentials(): """Mock AWS Credentials for moto.""" 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' @pytest.fixture(scope='function') def s3(aws_credentials): """Mock S3.""" with mock_aws(): import boto3 yield boto3.client('s3', region_name='us-east-1') @pytest.fixture(scope='function') def dynamodb(aws_credentials): """Mock DynamoDb.""" with mock_aws(): import boto3 yield boto3.resource('dynamodb', region_name='us-east-1')