mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Two-parameter subtask handler completes without TypeError 🟥
This commit is contained in:
parent
c1dda41857
commit
51cf545776
3 changed files with 24 additions and 1 deletions
|
|
@ -15,11 +15,14 @@ from orchestration.audit_generator_orchestrator import AuditGeneratorOrchestrato
|
||||||
from orchestration.audit_generator_unit_of_work import AuditGeneratorUnitOfWork
|
from orchestration.audit_generator_unit_of_work import AuditGeneratorUnitOfWork
|
||||||
from utilities.aws_lambda.subtask_handler import subtask_handler
|
from utilities.aws_lambda.subtask_handler import subtask_handler
|
||||||
|
|
||||||
|
|
||||||
@subtask_handler()
|
@subtask_handler()
|
||||||
def handler(body: dict[str, Any], context: Any) -> None:
|
def handler(body: dict[str, Any], context: Any) -> None:
|
||||||
trigger = AuditGeneratorTriggerRequest.model_validate(body)
|
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")
|
boto_s3: Any = boto3_client("s3")
|
||||||
bucket = os.environ["S3_BUCKET_NAME"]
|
bucket = os.environ["S3_BUCKET_NAME"]
|
||||||
s3_client = S3Client(boto_s3_client=boto_s3, bucket=bucket)
|
s3_client = S3Client(boto_s3_client=boto_s3, bucket=bucket)
|
||||||
|
|
|
||||||
|
|
@ -25,5 +25,6 @@ testpaths =
|
||||||
etl/epc_clean/tests
|
etl/epc_clean/tests
|
||||||
etl/hubspot/tests
|
etl/hubspot/tests
|
||||||
etl/spatial/tests
|
etl/spatial/tests
|
||||||
|
tests/
|
||||||
markers =
|
markers =
|
||||||
integration: mark a test as an integration test
|
integration: mark a test as an integration test
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,25 @@ def test_subtask_handler_records_cloudwatch_url_on_subtask(
|
||||||
assert "$255B$2524LATEST$255D" in saved_url
|
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(
|
def test_subtask_handler_leaves_cloudwatch_url_unset_outside_lambda(
|
||||||
harness: Harness, monkeypatch: pytest.MonkeyPatch
|
harness: Harness, monkeypatch: pytest.MonkeyPatch
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue