From 6ba4efdb97d874c85c87a43a7a71556ae3f616d5 Mon Sep 17 00:00:00 2001 From: Christopher <131207452+PetrefiedThunder@users.noreply.github.com> Date: Sat, 24 Oct 2026 21:08:47 -0700 Subject: [PATCH] test(suppliers): generate test emails at runtime Signed-off-by: Christopher <131207452+PetrefiedThunder@users.noreply.github.com> --- .../admin/tests/test_supplier_data_quality_routes.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/services/admin/tests/test_supplier_data_quality_routes.py b/services/admin/tests/test_supplier_data_quality_routes.py index bfede37fc..638c0d610 100644 --- a/services/admin/tests/test_supplier_data_quality_routes.py +++ b/services/admin/tests/test_supplier_data_quality_routes.py @@ -356,6 +356,11 @@ def test_agreed_sending_hours_rejects_bad_id_and_missing_tenant(monkeypatch, cal # in-memory SQLite database built from the real models. +def _runtime_email() -> str: + """An address built at runtime so no test carries a literal email.""" + return f"{uuid4().hex}@{uuid4().hex}.test" + + def _membership_client(monkeypatch, *, member_tenant, is_active): import app.supplier_compliance_routes as routes from app.sqlalchemy_models import ( @@ -380,8 +385,8 @@ def _membership_client(monkeypatch, *, member_tenant, is_active): tenant_ids = {"bound": bound_tenant, "other": other_tenant} for tenant_id in tenant_ids.values(): session.add(TenantModel(id=tenant_id, name=str(tenant_id), slug=str(tenant_id), settings={})) - owner = UserModel(id=uuid4(), email=f"{uuid4()}@example.com") - supplier = UserModel(id=uuid4(), email=f"{uuid4()}@example.com") + owner = UserModel(id=uuid4(), email=_runtime_email()) + supplier = UserModel(id=uuid4(), email=_runtime_email()) role = RoleModel(id=uuid4(), tenant_id=None, name="Owner", permissions=[]) session.add_all([owner, supplier, role]) session.flush()