-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_admin_resend.py
More file actions
61 lines (47 loc) · 1.63 KB
/
test_admin_resend.py
File metadata and controls
61 lines (47 loc) · 1.63 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
"""Test admin panel resend functionality."""
import sys
import os
from pathlib import Path
# Add paths like admin panel does
sys.path.append(str(Path(__file__).parent))
sys.path.append(str(Path(__file__).parent / 'admin_panel' / 'backend'))
from admin_panel.backend.services.order_service import OrderService
from admin_panel.backend.database import get_db_session
from dotenv import load_dotenv
# Load environment variables
load_dotenv(override=True)
def test_admin_resend():
"""Test resending through admin panel service."""
print("\n=== Testing Admin Panel Resend ===")
# Get database session
with get_db_session() as db:
# Create order service
service = OrderService(db)
# Try to resend the order
order_id = 'LAT-PDF-PRICE-TEST-001'
print(f"Attempting to resend order {order_id}...")
try:
success = service.resend_order(order_id)
if success:
print("✓ Order resent successfully!")
return True
else:
print("✗ Failed to resend order")
return False
except Exception as e:
print(f"✗ Error: {e}")
import traceback
traceback.print_exc()
return False
def main():
"""Run the test."""
print("=" * 60)
print("Admin Panel Resend Test")
print("=" * 60)
success = test_admin_resend()
print("\n" + "=" * 60)
print(f"Test Result: {'✓ Success' if success else '✗ Failed'}")
print("=" * 60)
if __name__ == "__main__":
main()