""" Utilities for identifying test data and internal accounts. Test data is generated by automated E2E tests and should be filterable in admin dashboards to show only real user data by default. Internal accounts belong to team members and should be excluded from abuse investigation views. """ # Email domains used by automated testing frameworks TEST_EMAIL_DOMAINS = [ "inbox.testmail.app", # Used by E2E happy path tests ] # Email domains belonging to internal team members INTERNAL_EMAIL_DOMAINS = [ "nomadkaraoke.com", # Team accounts "beveridge.uk", # Founder's personal domain ] def is_test_email(email: str) -> bool: """ Check if an email address belongs to automated test data. Args: email: Email address to check Returns: True if the email matches a test email domain pattern """ if not email: return False email_lower = email.lower() return any(email_lower.endswith(f"@{domain}") for domain in TEST_EMAIL_DOMAINS) def is_internal_email(email: str) -> bool: """Check if an email address belongs to an internal team member.""" if not email: return False email_lower = email.lower() return any(email_lower.endswith(f"@{domain}") for domain in INTERNAL_EMAIL_DOMAINS) def is_internal_or_test_email(email: str) -> bool: """Check if an email is internal or automated test data.""" return is_test_email(email) or is_internal_email(email)