fix
This commit is contained in:
35
order-events/tests/events/stopgap/test_patch_items.py
Normal file
35
order-events/tests/events/stopgap/test_patch_items.py
Normal file
@@ -0,0 +1,35 @@
|
||||
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'
|
||||
Reference in New Issue
Block a user