- Frontend v4 accessible sur réseau local (192.168.1.40) - Ports ouverts: 3002 (frontend), 5001 (backend), 5004 (dashboard) - Ollama GPU fonctionnel - Self-healing interactif - Dashboard confiance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
94 lines
2.9 KiB
Python
94 lines
2.9 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test du Backend Visual Workflow Builder
|
|
|
|
Auteur : Dom, Alice, Kiro - 08 janvier 2026
|
|
"""
|
|
|
|
import requests
|
|
import json
|
|
import time
|
|
import sys
|
|
|
|
def test_backend(base_url="http://localhost:5002"):
|
|
"""Test le backend VWB."""
|
|
print(f"🧪 Test du backend: {base_url}")
|
|
|
|
# Test 1: Health check
|
|
try:
|
|
response = requests.get(f"{base_url}/health", timeout=5)
|
|
if response.status_code == 200:
|
|
print("✅ Health check OK")
|
|
print(f" Réponse: {response.json()}")
|
|
else:
|
|
print(f"❌ Health check échoué: {response.status_code}")
|
|
return False
|
|
except Exception as e:
|
|
print(f"❌ Erreur health check: {e}")
|
|
return False
|
|
|
|
# Test 2: Liste des workflows
|
|
try:
|
|
response = requests.get(f"{base_url}/api/workflows", timeout=5)
|
|
if response.status_code == 200:
|
|
workflows = response.json()
|
|
print(f"✅ Liste workflows OK ({len(workflows)} workflows)")
|
|
else:
|
|
print(f"❌ Liste workflows échoué: {response.status_code}")
|
|
return False
|
|
except Exception as e:
|
|
print(f"❌ Erreur liste workflows: {e}")
|
|
return False
|
|
|
|
# Test 3: Création d'un workflow
|
|
try:
|
|
test_workflow = {
|
|
"name": "Test Workflow",
|
|
"description": "Workflow de test automatique",
|
|
"created_by": "test_script"
|
|
}
|
|
|
|
response = requests.post(
|
|
f"{base_url}/api/workflows",
|
|
json=test_workflow,
|
|
timeout=5
|
|
)
|
|
|
|
if response.status_code == 201:
|
|
created_workflow = response.json()
|
|
workflow_id = created_workflow['id']
|
|
print(f"✅ Création workflow OK (ID: {workflow_id})")
|
|
|
|
# Test 4: Récupération du workflow créé
|
|
response = requests.get(f"{base_url}/api/workflows/{workflow_id}", timeout=5)
|
|
if response.status_code == 200:
|
|
print("✅ Récupération workflow OK")
|
|
return True
|
|
else:
|
|
print(f"❌ Récupération workflow échoué: {response.status_code}")
|
|
return False
|
|
else:
|
|
print(f"❌ Création workflow échoué: {response.status_code}")
|
|
print(f" Réponse: {response.text}")
|
|
return False
|
|
except Exception as e:
|
|
print(f"❌ Erreur création workflow: {e}")
|
|
return False
|
|
|
|
if __name__ == "__main__":
|
|
print("🚀 Test automatique du backend VWB")
|
|
print("=" * 40)
|
|
|
|
# Attendre que le serveur soit prêt
|
|
print("⏳ Attente du démarrage du serveur...")
|
|
time.sleep(2)
|
|
|
|
success = test_backend()
|
|
|
|
if success:
|
|
print("\n✅ Tous les tests sont passés!")
|
|
sys.exit(0)
|
|
else:
|
|
print("\n❌ Certains tests ont échoué")
|
|
sys.exit(1)
|