gcp-hockey-results/motm_app/test_app.py

42 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""
Simple test script to verify the MOTM Flask application can start without errors.
"""
import sys
import os
# Add the current directory to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
try:
from main import app
print("✓ MOTM Flask application imported successfully")
# Test that we can create the app context
with app.app_context():
print("✓ Flask application context created successfully")
# Test that routes are registered
routes = [rule.rule for rule in app.url_map.iter_rules()]
print(f"✓ Found {len(routes)} registered routes")
# Check for key routes
key_routes = ['/', '/motm/', '/admin/motm', '/admin/squad']
for route in key_routes:
if any(route in r for r in routes):
print(f"✓ Key route {route} is registered")
else:
print(f"⚠ Key route {route} not found")
print("\n🎉 MOTM application test completed successfully!")
print("You can now run 'python main.py' to start the application.")
except ImportError as e:
print(f"❌ Import error: {e}")
print("Make sure all dependencies are installed: pip install -r requirements.txt")
sys.exit(1)
except Exception as e:
print(f"❌ Error: {e}")
sys.exit(1)