File size: 1,100 Bytes
bebe233
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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())