| |
| """ |
| 🚀 STANDALONE TEST RUNNER - ASANA INTEGRATION |
| Direct test execution without subprocess |
| """ |
|
|
| from datetime import datetime, timedelta |
| import json |
| import os |
| import sys |
| from typing import Any, Dict, List |
| import requests |
|
|
| |
| sys.path.append(os.path.dirname(os.path.abspath(__file__))) |
| from test_asana_integration_new import AsanaIntegrationTester |
|
|
|
|
| async def main(): |
| """Main execution function""" |
| print("🚀 Starting Asana Integration Tests (Standalone)") |
| print("=" * 50) |
| |
| |
| tester = AsanaIntegrationTester() |
| |
| |
| try: |
| response = requests.get(f"{tester.base_url}/health", timeout=2) |
| print(f"✅ Connected to {tester.base_url}/health") |
| print(f" Response: {response.json()}") |
| except Exception as e: |
| print(f"❌ Cannot connect to {tester.base_url}/health") |
| print(f" Error: {e}") |
| |
| |
| import socket |
| sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| result = sock.connect_ex(('localhost', 5058)) |
| sock.close() |
| |
| if result == 0: |
| print(f"✅ Port 5058 is in use, but connection failed anyway") |
| else: |
| print(f"❌ Port 5058 is not in use") |
| print(" Starting minimal API server...") |
| |
| |
| import subprocess |
| import threading |
| import time |
| |
| api_file = os.path.join("backend", "python-api-service", "minimal_api_app.py") |
| if os.path.exists(api_file): |
| env = os.environ.copy() |
| env['PYTHON_API_PORT'] = '5058' |
| |
| def start_server(): |
| subprocess.run([sys.executable, api_file], env=env, cwd=".") |
| |
| server_thread = threading.Thread(target=start_server, daemon=True) |
| server_thread.start() |
| |
| print("⏳ Waiting 3 seconds for server to start...") |
| time.sleep(3) |
| |
| try: |
| response = requests.get(f"{tester.base_url}/health", timeout=2) |
| print(f"✅ Server started successfully: {response.json()}") |
| except Exception as e2: |
| print(f"❌ Server still not accessible: {e2}") |
| return |
| else: |
| print(f"❌ API file not found: {api_file}") |
| return |
| |
| |
| results = await tester.run_all_tests() |
| |
| |
| tester.save_results() |
|
|
| if __name__ == "__main__": |
| import asyncio |
| asyncio.run(main()) |