| import asyncio |
| import sys |
| import os |
| from pathlib import Path |
|
|
| |
| project_root = Path(__file__).parent |
| sys.path.insert(0, str(project_root)) |
|
|
| def test_imports(): |
| """Test that all modules can be imported without errors""" |
| print("Testing module imports...") |
| |
| try: |
| from core.models import AgentConfig, Task, AgentMessage, SEOData |
| print("β Core models imported successfully") |
| except ImportError as e: |
| print(f"β Failed to import core models: {e}") |
| return False |
| |
| try: |
| from core.agent import BaseAgent |
| print("β Base agent imported successfully") |
| except ImportError as e: |
| print(f"β Failed to import base agent: {e}") |
| return False |
| |
| try: |
| from core.monetization import MonetizationEngine |
| print("β Monetization engine imported successfully") |
| except ImportError as e: |
| print(f"β Failed to import monetization engine: {e}") |
| return False |
| |
| |
| agent_modules = [ |
| "agents.ceo_agent", |
| "agents.seo_director_agent", |
| "agents.tech_seo_agent", |
| "agents.content_seo_agent", |
| "agents.programmatic_seo_agent", |
| "agents.link_authority_agent", |
| "agents.conversion_cro_agent", |
| "agents.client_management_agent", |
| "agents.automation_ops_agent", |
| "agents.self_improvement_agent" |
| ] |
| |
| for module in agent_modules: |
| try: |
| __import__(module) |
| print(f"β {module} imported successfully") |
| except ImportError as e: |
| print(f"β Failed to import {module}: {e}") |
| return False |
| |
| print("β All modules imported successfully!") |
| return True |
|
|
| def test_monetization(): |
| """Test monetization engine functionality""" |
| print("\nTesting monetization engine...") |
| |
| try: |
| from core.monetization import MonetizationEngine |
| |
| |
| engine = MonetizationEngine() |
| |
| |
| asyncio.run(engine.add_customer({"name": "Test Customer", "tier": "professional"})) |
| |
| |
| mrr = asyncio.run(engine.calculate_mrr()) |
| print(f"β MRR calculated: ${mrr}") |
| |
| |
| perf_metrics = {"revenue_increase": 10000} |
| bonus = asyncio.run(engine.generate_performance_bonus("cust_1", perf_metrics)) |
| print(f"β Performance bonus calculated: ${bonus}") |
| |
| |
| dashboard = asyncio.run(engine.get_monetization_dashboard()) |
| print(f"β Monetization dashboard retrieved with {dashboard['customer_metrics']['total_customers']} customers") |
| |
| print("β Monetization engine working correctly!") |
| return True |
| |
| except Exception as e: |
| print(f"β Monetization engine test failed: {e}") |
| return False |
|
|
| def test_agent_creation(): |
| """Test agent creation and basic functionality""" |
| print("\nTesting agent creation...") |
| |
| try: |
| from core.models import AgentConfig |
| from agents.ceo_agent import CEOStrategyAgent |
| |
| |
| config = AgentConfig(name="test_ceo", enabled=True, max_iterations=2) |
| agent = CEOStrategyAgent(config) |
| |
| print(f"β CEO agent created with name: {agent.name}") |
| |
| |
| assert agent.enabled == True |
| assert agent.max_iterations == 2 |
| print("β Agent properties set correctly") |
| |
| print("β Agent creation working correctly!") |
| return True |
| |
| except Exception as e: |
| print(f"β Agent creation test failed: {e}") |
| return False |
|
|
| def main(): |
| """Run all tests""" |
| print("AutoSEO Engine - Validation Tests\n") |
| print("="*40) |
| |
| success = True |
| success &= test_imports() |
| success &= test_monetization() |
| success &= test_agent_creation() |
| |
| print("\n" + "="*40) |
| if success: |
| print("π All tests passed! AutoSEO Engine is ready.") |
| else: |
| print("β Some tests failed. Please check the implementation.") |
| |
| return success |
|
|
| if __name__ == "__main__": |
| success = main() |
| sys.exit(0 if success else 1) |