LinkDesk/verify-setup.py

89 lines
2.4 KiB
Python

#!/usr/bin/env python3
"""
Verification script for VFX Project Management System setup
"""
import sys
import subprocess
import time
from pathlib import Path
def test_backend():
"""Test backend setup"""
print("Testing backend setup...")
# Test imports
try:
sys.path.append('backend')
from main import app
from fastapi.testclient import TestClient
client = TestClient(app)
response = client.get('/health')
if response.status_code == 200:
print("✓ Backend API is working")
print(f" Health check response: {response.json()}")
return True
else:
print(f"✗ Backend health check failed: {response.status_code}")
return False
except Exception as e:
print(f"✗ Backend test failed: {e}")
return False
def test_frontend():
"""Test frontend setup"""
print("Testing frontend setup...")
try:
# Check if node_modules exists
frontend_dir = Path("frontend")
node_modules = frontend_dir / "node_modules"
if not node_modules.exists():
print("✗ Frontend dependencies not installed")
return False
# Test build
result = subprocess.run(
["npm", "run", "build"],
cwd=frontend_dir,
capture_output=True,
text=True,
shell=True
)
if result.returncode == 0:
print("✓ Frontend builds successfully")
return True
else:
print(f"✗ Frontend build failed: {result.stderr}")
return False
except Exception as e:
print(f"✗ Frontend test failed: {e}")
return False
def main():
"""Main verification function"""
print("VFX Project Management System - Setup Verification")
print("=" * 55)
backend_ok = test_backend()
frontend_ok = test_frontend()
print("\n" + "=" * 55)
if backend_ok and frontend_ok:
print("✓ All tests passed! Setup is complete.")
print("\nTo start development:")
print("1. Backend: cd backend && uvicorn main:app --reload")
print("2. Frontend: cd frontend && npm run dev")
return 0
else:
print("✗ Some tests failed. Please check the setup.")
return 1
if __name__ == "__main__":
sys.exit(main())