renamem orders
This commit is contained in:
38
orders-events/tests/events/billing/test_close_window.py
Normal file
38
orders-events/tests/events/billing/test_close_window.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
from layercake.dynamodb import (
|
||||
DynamoDBPersistenceLayer,
|
||||
SortKey,
|
||||
TransactKey,
|
||||
)
|
||||
|
||||
import events.billing.close_window as app
|
||||
|
||||
|
||||
def test_close_window(
|
||||
dynamodb_seeds,
|
||||
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||
lambda_context: LambdaContext,
|
||||
):
|
||||
event = {
|
||||
'detail': {
|
||||
'keys': {
|
||||
'id': 'BILLING#ORG#cJtK9SsnJhKPyxESe7g3DG',
|
||||
'sk': 'START#2025-07-01#END#2025-07-31#SCHEDULE#AUTO_CLOSE',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
assert app.lambda_handler(event, lambda_context) # type: ignore
|
||||
|
||||
r = dynamodb_persistence_layer.collection.get_items(
|
||||
TransactKey('BILLING#ORG#cJtK9SsnJhKPyxESe7g3DG')
|
||||
+ SortKey('START#2025-07-01#END#2025-07-31')
|
||||
+ SortKey('START#2025-07-01#END#2025-07-31#SCHEDULE#AUTO_CLOSE#EXECUTED'),
|
||||
flatten_top=False,
|
||||
)
|
||||
|
||||
assert 's3_uri' in r['START#2025-07-01#END#2025-07-31']
|
||||
assert 'created_at' in r['START#2025-07-01#END#2025-07-31']
|
||||
assert 'updated_at' in r['START#2025-07-01#END#2025-07-31']
|
||||
assert r['START#2025-07-01#END#2025-07-31']['status'] == 'CLOSED'
|
||||
assert 'START#2025-07-01#END#2025-07-31#SCHEDULE#AUTO_CLOSE#EXECUTED' in r
|
||||
Reference in New Issue
Block a user