meal-order-manager/tests/test_terraform_email_report.py
Adam Moussa f48a82c476
Some checks are pending
Deploy API / Resolve target (push) Waiting to run
Deploy API / Deploy API to (push) Blocked by required conditions
feat(api): serve meals on ECS Fargate instead of Lambda (PLAT-215) (#199)
* feat(api): serve meals on ECS Fargate instead of Lambda

Keep the Flask app always-on with in-process jobs so CloudFront no longer fronts a cold-start API Gateway.

* fix(jobs): run delayed close and reminder deliveries

Wall-clock skip windows dropped the only weekly SQS attempt when Scheduler already fired in Eastern time. Dev schedules stay disabled.

* fix(api): return JSON objects and stop logging job payloads

Flask now jsonify-s handler dicts so API responses are not HTML, and the worker logs only event and status.

* fix(ci): restore the reusable workflow so the required check is named ci / ci

Inlining the job reported `ci` instead of the org ruleset's `ci / ci`.

* fix(secrets): drop unused os import so ruff check passes

* style: apply ruff format so ci-python-app lint passes

* fix(infra): give meals its own VPC because prod has none

* chore(security): re-key ALB SG checkov suppression after vpc.tf
2026-09-21 19:34:24 +00:00

46 lines
1.4 KiB
Python

"""email_report and the Lambda/API Gateway surface stay gone (PLAT-135 / PLAT-215)."""
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
TERRAFORM = ROOT / "terraform"
def test_email_report_handler_removed():
assert not (ROOT / "functions" / "email_report").exists()
assert not (ROOT / "functions").exists()
def test_lambda_and_api_gateway_packaging_removed():
for name in (
"lambda.tf",
"apigateway.tf",
"events.tf",
"artifacts.tf",
"build_packages.sh",
"build_packages_external.sh",
):
assert not (TERRAFORM / name).exists()
assert not (ROOT / "template.yaml").exists()
def test_email_report_not_in_remaining_config():
locals_tf = (TERRAFORM / "locals.tf").read_text()
iam_tf = (TERRAFORM / "iam.tf").read_text()
alarms = (TERRAFORM / "alarms.tf").read_text()
outputs = (TERRAFORM / "outputs.tf").read_text()
variables = (TERRAFORM / "variables.tf").read_text()
assert '"email_report"' not in locals_tf
assert "ses:SendRawEmail" not in iam_tf
assert "email-report" not in alarms
assert "email_report" not in outputs
assert "payroll_email" not in variables
assert "sender_email" not in variables
def test_job_schedules_disabled_outside_prod():
scheduler = (TERRAFORM / "scheduler.tf").read_text()
assert (
'state = local.is_prod ? "ENABLED" : "DISABLED"'
in scheduler
)