fix
This commit is contained in:
@@ -18,6 +18,7 @@ def pytest_configure():
|
||||
os.environ['COURSE_TABLE'] = PYTEST_TABLE_NAME
|
||||
os.environ['ENROLLMENT_TABLE'] = PYTEST_TABLE_NAME
|
||||
os.environ['ORDER_TABLE'] = PYTEST_TABLE_NAME
|
||||
os.environ['COURSE_TABLE'] = PYTEST_TABLE_NAME
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
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,
|
||||
@@ -1,10 +1,12 @@
|
||||
{"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"}}
|
||||
{"id": {"S": "9omWNKymwU5U4aeun6mWzZ"}, "sk": {"S": "metadata#tenant"}, "tenant_id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}}
|
||||
{"id": {"S": "9omWNKymwU5U4aeun6mWzZ"}, "sk": {"S": "metadata#tenant"}, "tenant_id": {"S": "ORG#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"}}
|
||||
{"id": {"S": "vacancies#cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "9omWNKymwU5U4aeun6mWzZ#1"}}
|
||||
{"id": {"S": "vacancies#cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "9omWNKymwU5U4aeun6mWzZ#2"}}
|
||||
{"id": {"S": "vacancies#cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "9omWNKymwU5U4aeun6mWzZ#3"}}
|
||||
{"id": {"S": "vacancies#cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "9omWNKymwU5U4aeun6mWzZ#3"}}
|
||||
{"id": {"S": "6a60d026-d383-4707-b093-b6eddea1a24e"}, "sk": {"S": "items"},"items": {"L": [{"M": {"id": {"S": "a810dd22-56c0-4d9b-8cd2-7e2ee9c45839"}, "name": {"S": "pytest"},"quantity": {"N": "1"},"unit_price": {"N": "109"}}}]}}
|
||||
{"id": {"S": "a810dd22-56c0-4d9b-8cd2-7e2ee9c45839"}, "sk": {"S": "metadata#betaeducacao"},"course_id": {"S": "dc1a0428-47bf-4db1-a5da-24be49c9fda6"},"create_date": {"S": "2025-06-05T12:13:54.371416+00:00"}}
|
||||
Reference in New Issue
Block a user