#!/usr/bin/env python3 """ Test script to verify domain recommendations are working properly """ import requests import json def test_domain_recommendations(): """Test recommendations for different domains""" base_url = "http://localhost:8002" # Test domains test_domains = [ "saas", "SaaS", # Test case sensitivity "ecommerce", "E-commerce", # Test case sensitivity and hyphen "healthcare", "finance", "gaming", "education", "media", "iot", "social", "elearning", "realestate", "travel", "manufacturing", "personal", "startup", "enterprise" ] print("๐Ÿงช Testing Domain Recommendations") print("=" * 50) for domain in test_domains: print(f"\n๐Ÿ” Testing domain: '{domain}'") # Test recommendation endpoint payload = { "domain": domain, "budget": 900.0 } try: response = requests.post(f"{base_url}/recommend/best", json=payload, timeout=10) if response.status_code == 200: data = response.json() recommendations = data.get('recommendations', []) print(f" โœ… Status: {response.status_code}") print(f" ๐Ÿ“ Response: {recommendations}") print(f" ๐Ÿ“Š Recommendations: {len(recommendations)}") if recommendations: print(f" ๐Ÿ† Top recommendation: {recommendations[0]['stack_name']}") print(f" ๐Ÿ’ฐ Cost: ${recommendations[0]['monthly_cost']}") print(f" ๐ŸŽฏ Domains: {recommendations[0].get('recommended_domains', 'N/A')}") else: print(" โš ๏ธ No recommendations found") else: print(f" โŒ Error: {response.status_code}") print(f" ๐Ÿ“ Response: {response.text}") except requests.exceptions.RequestException as e: print(f" โŒ Request failed: {e}") except Exception as e: print(f" โŒ Unexpected error: {e}") # Test available domains endpoint print(f"\n๐ŸŒ Testing available domains endpoint") try: response = requests.get(f"{base_url}/api/domains", timeout=10) if response.status_code == 200: data = response.json() domains = data.get('domains', []) print(f" โœ… Available domains: {len(domains)}") for domain in domains: print(f" - {domain['domain_name']} ({domain['project_scale']}, {domain['team_experience_level']})") else: print(f" โŒ Error: {response.status_code}") except Exception as e: print(f" โŒ Error: {e}") if __name__ == "__main__": test_domain_recommendations()