improve get items

This commit is contained in:
2025-05-22 23:18:59 -03:00
parent 585bcfcc2a
commit 812470aae4
8 changed files with 179 additions and 79 deletions

View File

@@ -4,13 +4,18 @@ import boto3
import jsonlines
import pytest
from layercake.dynamodb import DynamoDBPersistenceLayer
PYTEST_TABLE_NAME = 'pytest'
DYNAMODB_ENDPOINT_URL = 'http://localhost:8000'
PK = 'id'
SK = 'sk'
PYTEST_TABLE_NAME = os.getenv('PYTEST_TABLE_NAME', 'pytest')
# Check `pytest.ini` for more details.
DYNAMODB_ENDPOINT_URL = os.getenv('DYNAMODB_ENDPOINT_URL')
PK = os.getenv('DYNAMODB_PARTITION_KEY', 'pk')
SK = os.getenv('DYNAMODB_SORT_KEY', 'sk')
# https://docs.pytest.org/en/7.1.x/reference/reference.html#pytest.hookspec.pytest_configure
def pytest_configure():
os.environ['TZ'] = 'America/Sao_Paulo'
os.environ['DYNAMODB_PARTITION_KEY'] = PK
os.environ['DYNAMODB_SORT_KEY'] = SK
os.environ['PYTEST_TABLE_NAME'] = PYTEST_TABLE_NAME
@pytest.fixture
@@ -38,7 +43,9 @@ def dynamodb_client():
@pytest.fixture()
def dynamodb_persistence_layer(dynamodb_client) -> DynamoDBPersistenceLayer:
def dynamodb_persistence_layer(dynamodb_client):
from layercake.dynamodb import DynamoDBPersistenceLayer
return DynamoDBPersistenceLayer(PYTEST_TABLE_NAME, dynamodb_client)