Spaces:
Running
Running
| import asyncio | |
| from main import analyze_email_endpoint, EmailRequest | |
| import json | |
| async def run_tests(): | |
| print("--- Testing Tier 1: Whitelist ---") | |
| res1 = await analyze_email_endpoint(EmailRequest( | |
| sender="noreply@github.com", | |
| subject="Your receipt", | |
| body="...", | |
| urls=[] | |
| )) | |
| print(json.dumps(res1, indent=2)) | |
| print("\n--- Testing Tier 2: Text Heuristic (No URLs) ---") | |
| res2 = await analyze_email_endpoint(EmailRequest( | |
| sender="admin@unknown-domain.com", | |
| subject="URGENT: Password Reset Required", | |
| body="Please reset immediately.", | |
| urls=[] | |
| )) | |
| print(json.dumps(res2, indent=2)) | |
| print("\n--- Testing Tier 2: Async URLs ---") | |
| res3 = await analyze_email_endpoint(EmailRequest( | |
| sender="service@paypal-update.net", | |
| subject="Important Account Update", | |
| body="Click the link to verify your account.", | |
| urls=["http://chase-bank-verify-login.cx/auth", "http://google.com/"] | |
| )) | |
| print(json.dumps(res3, indent=2)) | |
| if __name__ == "__main__": | |
| asyncio.run(run_tests()) | |