""" Simple test to verify basic functionality """ import sys import os # Add the parent directory to the path to import the app sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) def test_imports(): """Test that all modules can be imported""" try: from app.main import app assert app is not None print("✅ FastAPI app imports successfully") except Exception as e: print(f"❌ FastAPI app import failed: {e}") assert False, f"App import failed: {e}" def test_models(): """Test that models can be imported""" try: from app.models.financial import Company, FinancialData, CalculatedMetrics assert Company is not None assert FinancialData is not None assert CalculatedMetrics is not None print("✅ Database models import successfully") except Exception as e: print(f"❌ Models import failed: {e}") assert False, f"Models import failed: {e}" def test_schemas(): """Test that schemas can be imported""" try: from app.schemas.financial import FinancialDataRequest, FinancialDataResponse assert FinancialDataRequest is not None assert FinancialDataResponse is not None print("✅ Pydantic schemas import successfully") except Exception as e: print(f"❌ Schemas import failed: {e}") assert False, f"Schemas import failed: {e}" def test_config(): """Test configuration""" try: from app.core.config import settings assert settings.APP_NAME in ["Stock Oracle", "Stock_Oracle"] # Allow both values assert settings.API_PREFIX == "/api/v1" print("✅ Configuration works correctly") except Exception as e: print(f"❌ Configuration failed: {e}") assert False, f"Configuration failed: {e}" def test_openapi_spec(): """Test OpenAPI specification generation""" try: from app.main import app openapi_schema = app.openapi() assert "openapi" in openapi_schema assert "info" in openapi_schema assert "paths" in openapi_schema # Check that key endpoints are documented paths = openapi_schema["paths"] assert "/api/v1/health" in paths assert "/api/v1/financial/data" in paths assert "/api/v1/metadata/catalog" in paths print("✅ OpenAPI specification generated successfully") except Exception as e: print(f"❌ OpenAPI generation failed: {e}") assert False, f"OpenAPI generation failed: {e}" if __name__ == "__main__": print("Running simple functionality tests...") test_imports() test_models() test_schemas() test_config() test_openapi_spec() print("\n🎉 All simple tests passed!")