update fix to unit price

This commit is contained in:
2025-07-03 10:55:52 -03:00
parent 5280f953c3
commit ce1c1b367e
6 changed files with 46 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
import os
from dataclasses import dataclass
import jsonlines
import pytest
PYTEST_TABLE_NAME = 'pytest'
@@ -59,3 +60,10 @@ def dynamodb_persistence_layer(dynamodb_client):
from layercake.dynamodb import DynamoDBPersistenceLayer
return DynamoDBPersistenceLayer(PYTEST_TABLE_NAME, dynamodb_client)
@pytest.fixture()
def dynamodb_seeds(dynamodb_client):
with jsonlines.open('tests/seeds.jsonl') as lines:
for line in lines:
dynamodb_client.put_item(TableName=PYTEST_TABLE_NAME, Item=line)

View File

@@ -5,14 +5,15 @@ from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
def test_daily_sync_course_metadata(
dynamodb_client,
dynamodb_seeds,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
lambda_context: LambdaContext,
):
app.lambda_handler({}, lambda_context) # type: ignore
collection = dynamodb_persistence_layer.collection
item = collection.get_item(
KeyPair('a810dd22-56c0-4d9b-8cd2-7e2ee9c45839', 'metadata#unit_price')
)
item = collection.get_item(KeyPair('a810dd22-56c0-4d9b-8cd2-7e2ee9c45839', '0'))
print(item)
assert item

View File

@@ -0,0 +1 @@
{"id": {"S": "a810dd22-56c0-4d9b-8cd2-7e2ee9c45839"}, "sk": {"S": "0"}, "name": {"S": "pytest"}}