fix retain key

This commit is contained in:
2025-05-23 10:30:54 -03:00
parent 812470aae4
commit a7ee787378
26 changed files with 117 additions and 166 deletions

View File

@@ -6,17 +6,21 @@ from http import HTTPMethod
import jsonlines
import pytest
from layercake.dynamodb import DynamoDBPersistenceLayer
PYTEST_TABLE_NAME = 'pytest'
PK = os.getenv('DYNAMODB_PARTITION_KEY')
SK = os.getenv('DYNAMODB_SORT_KEY')
PK = 'id'
SK = 'sk'
patch = pytest.MonkeyPatch()
patch.setenv('USER_TABLE', PYTEST_TABLE_NAME)
patch.setenv('COURSE_TABLE', PYTEST_TABLE_NAME)
patch.setenv('ENROLLMENT_TABLE', PYTEST_TABLE_NAME)
# 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['KONVIVA_API_URL'] = 'https://saladeaula.digital'
os.environ['DYNAMODB_PARTITION_KEY'] = PK
os.environ['DYNAMODB_SORT_KEY'] = SK
os.environ['USER_TABLE'] = PYTEST_TABLE_NAME
os.environ['COURSE_TABLE'] = PYTEST_TABLE_NAME
os.environ['ENROLLMENT_TABLE'] = PYTEST_TABLE_NAME
@dataclass
@@ -132,7 +136,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)