31 lines
869 B
Python
31 lines
869 B
Python
from aws_lambda_powertools.utilities.typing import LambdaContext
|
|
from layercake.dynamodb import DynamoDBPersistenceLayer, PartitionKey
|
|
|
|
import events.reporting.add_item as app
|
|
|
|
|
|
def test_add_item(
|
|
dynamodb_seeds,
|
|
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
|
lambda_context: LambdaContext,
|
|
):
|
|
event = {
|
|
'detail': {
|
|
'new_image': {
|
|
'id': '945e8672-1d72-45c6-b76c-ac06aa8b52ab',
|
|
'sk': 'METADATA#BILLING_TERMS',
|
|
'billing_day': 5,
|
|
'created_at': '2025-07-23T18:09:22.785678-03:00',
|
|
'org_id': 'edp8njvgQuzNkLx2ySNfAD',
|
|
}
|
|
}
|
|
}
|
|
|
|
assert app.lambda_handler(event, lambda_context) # type: ignore
|
|
|
|
r = dynamodb_persistence_layer.collection.query(
|
|
PartitionKey('BILLING#ORG#edp8njvgQuzNkLx2ySNfAD')
|
|
)
|
|
|
|
print(r)
|