"""pyTest config.""" import os import boto3 import pytest from moto import mock_aws from src.logic import store_state @pytest.fixture() def mocked_aws(): """Mock AWS.""" with mock_aws(): yield @pytest.fixture def mocked_dynamodb_table(request, mocked_aws): """Mock DynamoDB table.""" client = boto3.client('dynamodb') table_name = os.environ['STORE_STATE_TABLE_NAME'] if not hasattr(request, 'param') or request.param: client.create_table( TableName=table_name, AttributeDefinitions=[{'AttributeName': 'store_id', 'AttributeType': 'N'}], KeySchema=[{'AttributeName': 'store_id', 'KeyType': 'HASH'}], ProvisionedThroughput={'ReadCapacityUnits': 5, 'WriteCapacityUnits': 5}, ) resource = boto3.resource('dynamodb') table = resource.Table(table_name) yield table @pytest.fixture def mock_get_feed_statuses(request, mocker): """Mock the get_feed_statuses function.""" mock_config = request.param return mocker.patch.object(store_state, 'get_feed_statuses', **mock_config)