wip reenroll

This commit is contained in:
2025-09-11 21:53:08 -03:00
parent ac07ee0101
commit e51964bc8b
13 changed files with 106 additions and 567 deletions

View File

@@ -15,4 +15,6 @@ def test_reminder_access_period_before_30_days(
}
}
app.send_email = lambda *args, **kwargs: ...
assert app.lambda_handler(event, lambda_context) # type: ignore

View File

@@ -14,5 +14,6 @@ def test_reminder_cert_expiration_before_30_days(
}
}
}
app.send_email = lambda *args, **kwargs: ...
assert app.lambda_handler(event, lambda_context) # type: ignore

View File

@@ -15,4 +15,6 @@ def test_reminder_no_access_after_3_days(
}
}
app.send_email = lambda *args, **kwargs: ...
assert app.lambda_handler(event, lambda_context) # type: ignore

View File

@@ -15,4 +15,6 @@ def test_reminder_no_activity_after_7_days(
}
}
app.send_email = lambda *args, **kwargs: ...
assert app.lambda_handler(event, lambda_context) # type: ignore

View File

@@ -0,0 +1,30 @@
import app.events.reenroll_if_failed as app
from aws_lambda_powertools.utilities.typing import LambdaContext
from layercake.dynamodb import DynamoDBPersistenceLayer
def test_enroll(
seeds,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
lambda_context: LambdaContext,
):
event = {
'detail': {
'new_image': {
'id': '294e9864-8284-4287-b153-927b15d90900',
'sk': '0',
'user': {
'id': '2beb8642-aab4-4088-86d4-2966fac7c570',
'name': 'Gary Pihl',
'email': 'gary@boston.com',
'cpf': '83152103000',
},
'course': {
'id': '62bea9b7-971d-4ee8-ab56-942dc7ca6fcd',
'name': 'pytest',
},
}
}
}
enrollment = app.lambda_handler(event, lambda_context) # type: ignore
print(enrollment)

View File

@@ -18,7 +18,7 @@ def test_schedule_reminders(
'sk': '0',
'user': {
'id': '1234',
'name': 'Ozzy Orbourne',
'name': 'Ozzy Osbourne',
'email': 'ozzy@osbourne.com',
},
'course': {

View File

@@ -25,6 +25,12 @@
{"id": "14682b79-3df2-4351-9229-8b558af046a0", "sk": "METADATA#COURSE", "access_period": 360}
{"id": "1ee108ae-67d4-4545-bf6d-4e641cdaa4e0", "sk": "0", "score": 100, "course": {"name": "CIPA Grau de Risco 1"}, "user": {"name": "Kurt Cobain"}}
{"id": "1ee108ae-67d4-4545-bf6d-4e641cdaa4e0", "sk": "METADATA#COURSE", "cert": {"s3_uri": "s3://saladeaula.digital/certs/3c27ea9c-9464-46a1-9717-8c1441793186-cipa-grau-de-risco-1.html"}}
{"id": "1ee108ae-67d4-4545-bf6d-4e641cdaa4e0", "sk": "METADATA#COURSE", "cert": {"s3_uri": "s3://saladeaula.digital/certs/samples/cipa-grau-de-risco-1.html"}}
{"id": "1ee108ae-67d4-4545-bf6d-4e641cdaa4e0", "sk": "STARTED", "started_at": "2025-08-24T01:44:42.703012-03:06"}
{"id": "1ee108ae-67d4-4545-bf6d-4e641cdaa4e0", "sk": "COMPLETED", "completed_at": "2025-08-31T21:59:10.842467-03:00"}
{"id": "294e9864-8284-4287-b153-927b15d90900", "sk": "0"}
{"id": "294e9864-8284-4287-b153-927b15d90900", "sk": "METADATA#SUBSCRIPTION_COVERED", "updated_at": "2025-09-09T15:20:17.187461-03:00", "billing_day": 1, "org_id": "123", "created_at": "2025-09-09T15:20:14.021500-03:00", "billing_period": "START#2025-09-01#END#2025-09-30"}
{"id": "294e9864-8284-4287-b153-927b15d90900", "sk": "METADATA#COURSE", "access_period": 360, "created_at": "2025-09-09T09:11:29.292760-03:00", "cert": {"exp_interval": 360}}
{"id": "294e9864-8284-4287-b153-927b15d90900", "sk": "konviva", "class_id": 34, "user_id": 26943, "created_at": "2025-09-09T09:11:29.315247-03:00", "enrollment_id": 244488}
{"id": "294e9864-8284-4287-b153-927b15d90900", "sk": "METADATA#DEDUPLICATION_WINDOW", "offset_days": 90, "created_at": "2025-09-11T09:00:45.923035-03:00"}