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'
|
||||
@@ -1,28 +0,0 @@
|
||||
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey
|
||||
|
||||
import events.assign_tenant_cnpj as app
|
||||
|
||||
|
||||
def test_assign_tenant_cnpj(
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
event = {
|
||||
'detail': {
|
||||
'new_image': {
|
||||
'id': '9omWNKymwU5U4aeun6mWzZ',
|
||||
'cnpj': '15608435000190',
|
||||
'email': 'sergio@somosbeta.com.br',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert app.lambda_handler(event, lambda_context) # type: ignore
|
||||
|
||||
result = dynamodb_persistence_layer.collection.query(
|
||||
PartitionKey('9omWNKymwU5U4aeun6mWzZ')
|
||||
)
|
||||
|
||||
assert 4 == len(result['items'])
|
||||
@@ -25,5 +25,4 @@ def test_assign_tenant_cnpj(
|
||||
PartitionKey('9omWNKymwU5U4aeun6mWzZ')
|
||||
)
|
||||
|
||||
assert 4 == len(result['items'])
|
||||
print(result['items'])
|
||||
assert 3 == len(result['items'])
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey
|
||||
|
||||
import events.remove_slots_on_canceled as app
|
||||
import events.remove_slots_if_canceled as app
|
||||
|
||||
|
||||
def test_delete_slots_on_canceled(
|
||||
def test_remove_slots_if_canceled(
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
lambda_context: LambdaContext,
|
||||
Reference in New Issue
Block a user