dropshop / tests /test_email_parser.py
github-actions[bot]
Automated deployment from GitHub Actions: a9d5a91de63ad7224bafe6039fb2b7479388fbf4
0a8c81b
Raw History Blame Contribute Delete
1.57 kB
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'apps/engine')))
from src.agents.email_parsing_agent import EmailParsingAgent
import json
def run_tests():
print("🤖 Starting Email Parsing Agent Tests...")
agent = EmailParsingAgent()
test_cases = [
{
"name": "Chinese 1688 Shipping Notification",
"body": """
【阿里巴巴】亲,您的订单已发货!
订单号: 1688-9923847293
买家:张三
运单号: YT882930491823
物流公司: 圆通速递
请注意查收。
"""
},
{
"name": "English Supplier Notification",
"body": """
Hello VLTA Dropshipping,
Good news! Your order has been shipped.
Order # S2-847291
Waybill: SF938472918342
Shipped via: SF Express International
Thanks,
Supplier Team
"""
},
{
"name": "Spam/Marketing Email",
"body": """
Huge Summer Sale! Get 50% discount on all new items.
Check out our latest newsletter for more details.
"""
}
]
for idx, case in enumerate(test_cases):
print(f"\n--- Test Case {idx+1}: {case['name']} ---")
result = agent.parse_inbound_email(case['body'])
print(json.dumps(result, indent=2, ensure_ascii=False))
if __name__ == "__main__":
run_tests()