This commit is contained in:
2025-08-28 12:25:15 -03:00
parent 83c97f409b
commit a98af3dca5
4 changed files with 104 additions and 9 deletions

View File

@@ -0,0 +1,36 @@
import app.events.schedule_reminders as app
from aws_lambda_powertools.utilities.typing import LambdaContext
from layercake.dynamodb import (
DynamoDBPersistenceLayer,
PartitionKey,
)
def test_schedule_reminders(
seeds,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
lambda_context: LambdaContext,
):
event = {
'detail': {
'new_image': {
'id': '14682b79-3df2-4351-9229-8b558af046a0',
'sk': '0',
'user': {
'id': '1234',
'name': 'Ozzy Orbourne',
'email': 'ozzy@osbourne.com',
},
'course': {
'id': '12334',
'name': 'pytest',
},
}
}
}
assert app.lambda_handler(event, lambda_context) # type: ignore
r = dynamodb_persistence_layer.collection.query(
PartitionKey('14682b79-3df2-4351-9229-8b558af046a0')
)
assert len(r['items']) == 4

View File

@@ -21,4 +21,5 @@
// Enrollment
{"id": "6437a282-6fe8-4e4d-9eb0-da1007238007", "sk": "0", "status": "IN_PROGRESS", "progress": 10}
{"id": "845fe390-e3c3-4514-97f8-c42de0566cf0", "sk": "0", "status": "COMPLETED", "progress": 100}
{"id": "845fe390-e3c3-4514-97f8-c42de0566cf0", "sk": "0", "status": "COMPLETED", "progress": 100}
{"id": "14682b79-3df2-4351-9229-8b558af046a0", "sk": "METADATA#COURSE", "access_period": 360}