remove items on canceled order
This commit is contained in:
@@ -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'
|
||||
@@ -1,6 +1,6 @@
|
||||
{"id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "metadata#payment_policy"}, "due_days": {"N": "90"}}
|
||||
{"id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "metadata#billing_policy"}, "billing_day": {"N": "1"}, "payment_method": {"S": "PIX"}}
|
||||
{"id": {"S": "9omWNKymwU5U4aeun6mWzZ"}, "sk": {"S": "0"}, "total": {"N": "398"}, "status": {"S": "PENDING"}, "payment_method": {"S": "MANUAL"}, "tenant": {"S": "cJtK9SsnJhKPyxESe7g3DG"}}
|
||||
{"id": {"S": "9omWNKymwU5U4aeun6mWzZ"}, "sk": {"S": "0"}, "total": {"N": "398"}, "status": {"S": "PENDING"}, "payment_method": {"S": "MANUAL"}, "tenant_id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}}
|
||||
{"id": {"S": "cnpj"}, "sk": {"S": "15608435000190"}, "user_id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}}
|
||||
{"id": {"S": "email"}, "sk": {"S": "sergio@somosbeta.com.br"}, "user_id": {"S": "5OxmMjL-ujoR5IMGegQz"}}
|
||||
{"id": {"S": "5OxmMjL-ujoR5IMGegQz"}, "sk": {"S": "0"}, "name": {"S": "Sérgio R Siqueira"}}
|
||||
|
||||
Reference in New Issue
Block a user