"""email_report is removed from Terraform, SAM, and the functions tree (PLAT-135).""" from pathlib import Path ROOT = Path(__file__).resolve().parents[1] TERRAFORM = ROOT / "terraform" def _read(name: str) -> str: return (TERRAFORM / name).read_text() def test_email_report_handler_removed(): assert not (ROOT / "functions" / "email_report").exists() def test_email_report_not_in_function_packages(): locals_tf = _read("locals.tf") assert '"email_report"' not in locals_tf packages_sh = _read("build_packages.sh") assert "email_report" not in packages_sh def test_payroll_email_schedules_removed(): events = _read("events.tf") assert "payroll-email-est" not in events assert "payroll-email-edt" not in events assert "email_report" not in events def test_email_report_lambda_and_role_removed(): lambda_tf = _read("lambda.tf") iam_tf = _read("iam.tf") alarms = _read("alarms.tf") outputs = _read("outputs.tf") variables = _read("variables.tf") assert "aws_lambda_function.email_report" not in lambda_tf assert "aws_iam_role.email_report" not in iam_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_email_report_removed_from_sam_template(): template = (ROOT / "template.yaml").read_text() assert "EmailReportFunction" not in template assert "functions/email_report/" not in template assert "PayrollEmail" not in template assert "SenderEmail" not in template assert "ses:SendRawEmail" not in template