finish seat
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair, PartitionKey
|
||||
|
||||
import events.start_fulfillment as app
|
||||
|
||||
@@ -9,12 +9,14 @@ def test_fulfillment_enrollments(
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
order_id = '9b9441d2-4ae3-4b50-8cb6-71e872d4492a'
|
||||
org_id = 'fee6f09b-e9fe-468d-b783-3dea5279d4dc'
|
||||
event = {
|
||||
'detail': {
|
||||
'new_image': {
|
||||
'id': '9b9441d2-4ae3-4b50-8cb6-71e872d4492a',
|
||||
'id': order_id,
|
||||
'sk': 'FULFILLMENT',
|
||||
'org_id': 'cJtK9SsnJhKPyxESe7g3DG',
|
||||
'org_id': org_id,
|
||||
'status': 'IN_PROGRESS',
|
||||
}
|
||||
}
|
||||
@@ -22,21 +24,42 @@ def test_fulfillment_enrollments(
|
||||
|
||||
assert app.lambda_handler(event, lambda_context) # type: ignore
|
||||
|
||||
r = dynamodb_persistence_layer.collection.query(
|
||||
KeyPair(order_id, 'ENROLLMENT#'),
|
||||
)
|
||||
assert len(r['items']) == 3
|
||||
|
||||
seats = dynamodb_persistence_layer.collection.query(
|
||||
PartitionKey(f'SEAT#ORG#{org_id}')
|
||||
)
|
||||
assert len(seats['items']) == 1
|
||||
|
||||
scheduled = dynamodb_persistence_layer.collection.query(
|
||||
PartitionKey(f'SCHEDULED#ORG#{org_id}')
|
||||
)
|
||||
assert len(scheduled['items']) == 1
|
||||
|
||||
|
||||
def test_fulfillment_items(
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
org_id = 'fee6f09b-e9fe-468d-b783-3dea5279d4dc'
|
||||
event = {
|
||||
'detail': {
|
||||
'new_image': {
|
||||
'id': '9f7fa055-7c0b-418a-b023-77477d1895b9',
|
||||
'sk': 'FULFILLMENT',
|
||||
'org_id': 'cJtK9SsnJhKPyxESe7g3DG',
|
||||
'org_id': org_id,
|
||||
'status': 'IN_PROGRESS',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert app.lambda_handler(event, lambda_context) # type: ignore
|
||||
|
||||
seats = dynamodb_persistence_layer.collection.query(
|
||||
PartitionKey(f'SEAT#ORG#{org_id}')
|
||||
)
|
||||
assert len(seats['items']) == 2
|
||||
|
||||
Reference in New Issue
Block a user