Mock AWS Services
Pytest tip:
Use moto to mock AWS services such as S3 and DynamoDB:
👇
import bot03 import pytest from moto import mock_dynamodb2 @pytest.fixture def dynamodb_table(): with mock_dynamodb2(): dynamodb = bot03.resource("dynamodb") table = dynamodb.create_table( TableName="test", KeySchema=[ {"AttributeName": "PK", "KeyType": "HASH"}, {"AttributeName": "SK", "KeyType": "Range"}, ], AttributeDefinitions=[ {"AttributeName": "PK", "AttributeType": "S"}, {"AttributeName": "SK", "AttributeType": "S"}, {"AttributeName": "GSIPK", "AttributeType": "S"}, {"AttributeName": "GSISK", "AttributeType": "S"}, ], GlobalSecondarylndexes=[ { "IndexName": "GS1", "KeySchema": [ {"AttributeName": "GS1PK", "KeyType": "HASH"}, {"AttributeName": "GS1SK", "KeyType": "Range"}, ], "Projection": {"ProjectionType": "ALL"}, }, ], ) table.delete()