update fix to unit price
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
1
courses-events/tests/seeds.jsonl
Normal file
1
courses-events/tests/seeds.jsonl
Normal file
@@ -0,0 +1 @@
|
||||
{"id": {"S": "a810dd22-56c0-4d9b-8cd2-7e2ee9c45839"}, "sk": {"S": "0"}, "name": {"S": "pytest"}}
|
||||
Reference in New Issue
Block a user