#!/usr/bin/env python3 """Simple test script for API foundation.""" import urllib.request import json def test_health(): """Test health endpoint.""" response = urllib.request.urlopen('http://localhost:8001/api/health') data = json.loads(response.read().decode()) print(f"✓ Health check: {data}") def test_cors(): """Test CORS headers.""" req = urllib.request.Request('http://localhost:8001/api/health', headers={'Origin': 'http://localhost:5173'}) response = urllib.request.urlopen(req) cors_origin = response.headers.get('Access-Control-Allow-Origin') cors_creds = response.headers.get('Access-Control-Allow-Credentials') print(f"✓ CORS Origin: {cors_origin}") print(f"✓ CORS Credentials: {cors_creds}") if __name__ == '__main__': print("Testing API Foundation...") test_health() test_cors() print("\nAll tests passed!")