diff --git a/applications/audit_generator/handler.py b/applications/audit_generator/handler.py index 533f5d91..76f53538 100644 --- a/applications/audit_generator/handler.py +++ b/applications/audit_generator/handler.py @@ -15,11 +15,14 @@ from orchestration.audit_generator_orchestrator import AuditGeneratorOrchestrato from orchestration.audit_generator_unit_of_work import AuditGeneratorUnitOfWork from utilities.aws_lambda.subtask_handler import subtask_handler + @subtask_handler() def handler(body: dict[str, Any], context: Any) -> None: trigger = AuditGeneratorTriggerRequest.model_validate(body) - boto3_client: Any = boto3.client # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType] + boto3_client: Any = ( + boto3.client + ) # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType] boto_s3: Any = boto3_client("s3") bucket = os.environ["S3_BUCKET_NAME"] s3_client = S3Client(boto_s3_client=boto_s3, bucket=bucket) diff --git a/pytest.ini b/pytest.ini index 2bcd6178..cb6af047 100644 --- a/pytest.ini +++ b/pytest.ini @@ -25,5 +25,6 @@ testpaths = etl/epc_clean/tests etl/hubspot/tests etl/spatial/tests + tests/ markers = integration: mark a test as an integration test diff --git a/tests/utilities/aws_lambda/test_subtask_handler.py b/tests/utilities/aws_lambda/test_subtask_handler.py index d671adc4..3b33d7fd 100644 --- a/tests/utilities/aws_lambda/test_subtask_handler.py +++ b/tests/utilities/aws_lambda/test_subtask_handler.py @@ -228,6 +228,25 @@ def test_subtask_handler_records_cloudwatch_url_on_subtask( assert "$255B$2524LATEST$255D" in saved_url +def test_subtask_handler_completes_subtask_without_orchestrator_parameter( + harness: Harness, +) -> None: + # arrange + task, subtask = harness.orchestrator.create_task_with_subtask( + task_source="manual:test" + ) + + @subtask_handler(orchestrator_cm=harness.factory) + def handler(body: dict[str, Any], context: Any) -> None: + return None + + # act + handler(_direct_event(task.id, subtask.id), context=None) + + # assert + assert harness.subtasks.get(subtask.id).status is SubTaskStatus.COMPLETE + + def test_subtask_handler_leaves_cloudwatch_url_unset_outside_lambda( harness: Harness, monkeypatch: pytest.MonkeyPatch ) -> None: