remove items on canceled order

This commit is contained in:
2025-07-21 17:27:36 -03:00
parent 64946471b9
commit 024cd63a92
5 changed files with 30 additions and 89 deletions

View File

@@ -1,35 +0,0 @@
from decimal import Decimal
import app.events.stopgap.patch_items as app
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
from ...conftest import LambdaContext
def test_patch_items(
dynamodb_seeds,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
lambda_context: LambdaContext,
):
event = {
'detail': {
'new_image': {
'id': '9omWNKymwU5U4aeun6mWzZ',
'items': [
{
'id': 'a810dd22-56c0-4d9b-8cd2-7e2ee9c45839',
'name': 'pytest',
'quantity': 17,
'unit_price': Decimal('87.2'),
},
],
}
},
}
assert app.lambda_handler(event, lambda_context) # type: ignore
result = dynamodb_persistence_layer.collection.get_item(
KeyPair('9omWNKymwU5U4aeun6mWzZ', 'items')
)
assert result['items'][0]['id'] == 'dc1a0428-47bf-4db1-a5da-24be49c9fda6'