#!/usr/bin/env python3 """ Simple test script to verify the Virtual Board Member AI System setup. """ import os import sys from pathlib import Path # Add the app directory to the Python path sys.path.insert(0, str(Path(__file__).parent / "app")) def test_imports(): """Test that all core modules can be imported.""" print("šŸ” Testing imports...") try: from app.core.config import settings print("āœ… Settings imported successfully") from app.core.database import Base, get_db print("āœ… Database modules imported successfully") from app.core.logging import setup_logging, get_logger print("āœ… Logging modules imported successfully") from app.main import app print("āœ… Main app imported successfully") from app.models.user import User, UserRole print("āœ… User model imported successfully") return True except ImportError as e: print(f"āŒ Import failed: {e}") return False def test_configuration(): """Test configuration loading.""" print("\nšŸ” Testing configuration...") try: from app.core.config import settings # Test basic settings assert settings.APP_NAME == "Virtual Board Member AI" assert settings.APP_VERSION == "0.1.0" assert settings.ENVIRONMENT in ["development", "testing", "production"] print("āœ… Configuration loaded successfully") print(f" App Name: {settings.APP_NAME}") print(f" Version: {settings.APP_VERSION}") print(f" Environment: {settings.ENVIRONMENT}") print(f" Debug Mode: {settings.DEBUG}") return True except Exception as e: print(f"āŒ Configuration test failed: {e}") return False def test_logging(): """Test logging setup.""" print("\nšŸ” Testing logging...") try: from app.core.logging import setup_logging, get_logger # Setup logging setup_logging() logger = get_logger("test") # Test logging logger.info("Test log message", test=True) print("āœ… Logging setup successful") return True except Exception as e: print(f"āŒ Logging test failed: {e}") return False def test_fastapi_app(): """Test FastAPI application creation.""" print("\nšŸ” Testing FastAPI application...") try: from app.main import app # Test basic app properties assert app.title == "Virtual Board Member AI" assert app.version == "0.1.0" print("āœ… FastAPI application created successfully") print(f" Title: {app.title}") print(f" Version: {app.version}") print(f" Debug: {app.debug}") return True except Exception as e: print(f"āŒ FastAPI test failed: {e}") return False def test_project_structure(): """Test that required directories and files exist.""" print("\nšŸ” Testing project structure...") required_files = [ "pyproject.toml", "env.example", "docker-compose.dev.yml", "Dockerfile.dev", "README.md", "DEVELOPMENT_PLAN.md", "app/main.py", "app/core/config.py", "app/core/database.py", "app/core/logging.py", "app/api/v1/api.py", "app/models/user.py", ] missing_files = [] for file_path in required_files: if not Path(file_path).exists(): missing_files.append(file_path) else: print(f"āœ… {file_path}") if missing_files: print(f"āŒ Missing files: {missing_files}") return False print("āœ… All required files present") return True def main(): """Run all tests.""" print("šŸš€ Testing Virtual Board Member AI System Setup") print("=" * 50) tests = [ test_project_structure, test_imports, test_configuration, test_logging, test_fastapi_app, ] passed = 0 total = len(tests) for test in tests: if test(): passed += 1 print() print("=" * 50) print(f"šŸ“Š Test Results: {passed}/{total} tests passed") if passed == total: print("šŸŽ‰ All tests passed! The setup is working correctly.") print("\nšŸ“ Next steps:") print(" 1. Copy env.example to .env and configure your settings") print(" 2. Run: docker-compose -f docker-compose.dev.yml up -d") print(" 3. Install dependencies: poetry install") print(" 4. Start the application: poetry run uvicorn app.main:app --reload") return 0 else: print("āŒ Some tests failed. Please check the errors above.") return 1 if __name__ == "__main__": sys.exit(main())