diff --git a/src/backend/.env b/src/backend/.env deleted file mode 100644 index d4c48ac..0000000 --- a/src/backend/.env +++ /dev/null @@ -1 +0,0 @@ -JWT_SECRET_KEY=dev-secret-key-12345 diff --git a/src/backend/__pycache__/__init__.cpython-314.pyc b/src/backend/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index a20bf94..0000000 Binary files a/src/backend/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/src/backend/__pycache__/cache.cpython-314.pyc b/src/backend/__pycache__/cache.cpython-314.pyc deleted file mode 100644 index 3048c30..0000000 Binary files a/src/backend/__pycache__/cache.cpython-314.pyc and /dev/null differ diff --git a/src/backend/__pycache__/config.cpython-314.pyc b/src/backend/__pycache__/config.cpython-314.pyc deleted file mode 100644 index 651beb6..0000000 Binary files a/src/backend/__pycache__/config.cpython-314.pyc and /dev/null differ diff --git a/src/backend/__pycache__/conftest.cpython-314-pytest-9.0.3.pyc b/src/backend/__pycache__/conftest.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index 3df8c21..0000000 Binary files a/src/backend/__pycache__/conftest.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/__pycache__/conftest.cpython-314.pyc b/src/backend/__pycache__/conftest.cpython-314.pyc deleted file mode 100644 index feac0e6..0000000 Binary files a/src/backend/__pycache__/conftest.cpython-314.pyc and /dev/null differ diff --git a/src/backend/__pycache__/database.cpython-314.pyc b/src/backend/__pycache__/database.cpython-314.pyc deleted file mode 100644 index dfbdcff..0000000 Binary files a/src/backend/__pycache__/database.cpython-314.pyc and /dev/null differ diff --git a/src/backend/__pycache__/main.cpython-314.pyc b/src/backend/__pycache__/main.cpython-314.pyc deleted file mode 100644 index ca9dfda..0000000 Binary files a/src/backend/__pycache__/main.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/__init__.cpython-314.pyc b/src/backend/routers/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index 82d199e..0000000 Binary files a/src/backend/routers/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/alerts.cpython-314.pyc b/src/backend/routers/__pycache__/alerts.cpython-314.pyc deleted file mode 100644 index 3782a17..0000000 Binary files a/src/backend/routers/__pycache__/alerts.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/auth.cpython-314.pyc b/src/backend/routers/__pycache__/auth.cpython-314.pyc deleted file mode 100644 index eb4cc94..0000000 Binary files a/src/backend/routers/__pycache__/auth.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/dashboard.cpython-314.pyc b/src/backend/routers/__pycache__/dashboard.cpython-314.pyc deleted file mode 100644 index 70dc7d1..0000000 Binary files a/src/backend/routers/__pycache__/dashboard.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/data_sync.cpython-314.pyc b/src/backend/routers/__pycache__/data_sync.cpython-314.pyc deleted file mode 100644 index c0b52bc..0000000 Binary files a/src/backend/routers/__pycache__/data_sync.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/insider_trades.cpython-314.pyc b/src/backend/routers/__pycache__/insider_trades.cpython-314.pyc deleted file mode 100644 index 6d413ca..0000000 Binary files a/src/backend/routers/__pycache__/insider_trades.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/peers.cpython-314.pyc b/src/backend/routers/__pycache__/peers.cpython-314.pyc deleted file mode 100644 index 8588cf1..0000000 Binary files a/src/backend/routers/__pycache__/peers.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/prices.cpython-314.pyc b/src/backend/routers/__pycache__/prices.cpython-314.pyc deleted file mode 100644 index 7f5ce70..0000000 Binary files a/src/backend/routers/__pycache__/prices.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/screeners.cpython-314.pyc b/src/backend/routers/__pycache__/screeners.cpython-314.pyc deleted file mode 100644 index 048eb8d..0000000 Binary files a/src/backend/routers/__pycache__/screeners.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/search.cpython-314.pyc b/src/backend/routers/__pycache__/search.cpython-314.pyc deleted file mode 100644 index 7dd079e..0000000 Binary files a/src/backend/routers/__pycache__/search.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/sec_filings.cpython-314.pyc b/src/backend/routers/__pycache__/sec_filings.cpython-314.pyc deleted file mode 100644 index 1f595de..0000000 Binary files a/src/backend/routers/__pycache__/sec_filings.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/sectors.cpython-314.pyc b/src/backend/routers/__pycache__/sectors.cpython-314.pyc deleted file mode 100644 index 08f9f7c..0000000 Binary files a/src/backend/routers/__pycache__/sectors.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/sentiment.cpython-314.pyc b/src/backend/routers/__pycache__/sentiment.cpython-314.pyc deleted file mode 100644 index 7ad76cf..0000000 Binary files a/src/backend/routers/__pycache__/sentiment.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/stocks.cpython-314.pyc b/src/backend/routers/__pycache__/stocks.cpython-314.pyc deleted file mode 100644 index ef39e02..0000000 Binary files a/src/backend/routers/__pycache__/stocks.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/strategies.cpython-314.pyc b/src/backend/routers/__pycache__/strategies.cpython-314.pyc deleted file mode 100644 index 6ab678f..0000000 Binary files a/src/backend/routers/__pycache__/strategies.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/stream.cpython-314.pyc b/src/backend/routers/__pycache__/stream.cpython-314.pyc deleted file mode 100644 index 2209e84..0000000 Binary files a/src/backend/routers/__pycache__/stream.cpython-314.pyc and /dev/null differ diff --git a/src/backend/routers/__pycache__/watchlists.cpython-314.pyc b/src/backend/routers/__pycache__/watchlists.cpython-314.pyc deleted file mode 100644 index 9b5d25c..0000000 Binary files a/src/backend/routers/__pycache__/watchlists.cpython-314.pyc and /dev/null differ diff --git a/src/backend/schemas/__pycache__/__init__.cpython-314.pyc b/src/backend/schemas/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index dce2e91..0000000 Binary files a/src/backend/schemas/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/src/backend/schemas/__pycache__/alert.cpython-314.pyc b/src/backend/schemas/__pycache__/alert.cpython-314.pyc deleted file mode 100644 index d4de7dc..0000000 Binary files a/src/backend/schemas/__pycache__/alert.cpython-314.pyc and /dev/null differ diff --git a/src/backend/schemas/__pycache__/auth.cpython-314.pyc b/src/backend/schemas/__pycache__/auth.cpython-314.pyc deleted file mode 100644 index 1f61c8b..0000000 Binary files a/src/backend/schemas/__pycache__/auth.cpython-314.pyc and /dev/null differ diff --git a/src/backend/schemas/__pycache__/insider_trade.cpython-314.pyc b/src/backend/schemas/__pycache__/insider_trade.cpython-314.pyc deleted file mode 100644 index 54f0150..0000000 Binary files a/src/backend/schemas/__pycache__/insider_trade.cpython-314.pyc and /dev/null differ diff --git a/src/backend/schemas/__pycache__/price.cpython-314.pyc b/src/backend/schemas/__pycache__/price.cpython-314.pyc deleted file mode 100644 index ebed7fb..0000000 Binary files a/src/backend/schemas/__pycache__/price.cpython-314.pyc and /dev/null differ diff --git a/src/backend/schemas/__pycache__/screener.cpython-314.pyc b/src/backend/schemas/__pycache__/screener.cpython-314.pyc deleted file mode 100644 index c9e358c..0000000 Binary files a/src/backend/schemas/__pycache__/screener.cpython-314.pyc and /dev/null differ diff --git a/src/backend/schemas/__pycache__/sec_filing.cpython-314.pyc b/src/backend/schemas/__pycache__/sec_filing.cpython-314.pyc deleted file mode 100644 index c5c0655..0000000 Binary files a/src/backend/schemas/__pycache__/sec_filing.cpython-314.pyc and /dev/null differ diff --git a/src/backend/schemas/__pycache__/sector_rotation.cpython-314.pyc b/src/backend/schemas/__pycache__/sector_rotation.cpython-314.pyc deleted file mode 100644 index 8419509..0000000 Binary files a/src/backend/schemas/__pycache__/sector_rotation.cpython-314.pyc and /dev/null differ diff --git a/src/backend/schemas/__pycache__/stock.cpython-314.pyc b/src/backend/schemas/__pycache__/stock.cpython-314.pyc deleted file mode 100644 index b2f9bf0..0000000 Binary files a/src/backend/schemas/__pycache__/stock.cpython-314.pyc and /dev/null differ diff --git a/src/backend/schemas/__pycache__/strategy.cpython-314.pyc b/src/backend/schemas/__pycache__/strategy.cpython-314.pyc deleted file mode 100644 index 297017e..0000000 Binary files a/src/backend/schemas/__pycache__/strategy.cpython-314.pyc and /dev/null differ diff --git a/src/backend/schemas/__pycache__/watchlist.cpython-314.pyc b/src/backend/schemas/__pycache__/watchlist.cpython-314.pyc deleted file mode 100644 index de826fc..0000000 Binary files a/src/backend/schemas/__pycache__/watchlist.cpython-314.pyc and /dev/null differ diff --git a/src/backend/services/__pycache__/__init__.cpython-314.pyc b/src/backend/services/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index 025a117..0000000 Binary files a/src/backend/services/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/src/backend/services/__pycache__/auth.cpython-314.pyc b/src/backend/services/__pycache__/auth.cpython-314.pyc deleted file mode 100644 index 61a9ca5..0000000 Binary files a/src/backend/services/__pycache__/auth.cpython-314.pyc and /dev/null differ diff --git a/src/backend/services/__pycache__/backtest_service.cpython-314.pyc b/src/backend/services/__pycache__/backtest_service.cpython-314.pyc deleted file mode 100644 index 41294a4..0000000 Binary files a/src/backend/services/__pycache__/backtest_service.cpython-314.pyc and /dev/null differ diff --git a/src/backend/services/__pycache__/email.cpython-314.pyc b/src/backend/services/__pycache__/email.cpython-314.pyc deleted file mode 100644 index eb01bbe..0000000 Binary files a/src/backend/services/__pycache__/email.cpython-314.pyc and /dev/null differ diff --git a/src/backend/services/__pycache__/market_data.cpython-314.pyc b/src/backend/services/__pycache__/market_data.cpython-314.pyc deleted file mode 100644 index 7c4113d..0000000 Binary files a/src/backend/services/__pycache__/market_data.cpython-314.pyc and /dev/null differ diff --git a/src/backend/services/__pycache__/rate_limiter.cpython-314.pyc b/src/backend/services/__pycache__/rate_limiter.cpython-314.pyc deleted file mode 100644 index 009acc5..0000000 Binary files a/src/backend/services/__pycache__/rate_limiter.cpython-314.pyc and /dev/null differ diff --git a/src/backend/services/__pycache__/rotation_service.cpython-314.pyc b/src/backend/services/__pycache__/rotation_service.cpython-314.pyc deleted file mode 100644 index f0585bc..0000000 Binary files a/src/backend/services/__pycache__/rotation_service.cpython-314.pyc and /dev/null differ diff --git a/src/backend/services/__pycache__/screener_service.cpython-314.pyc b/src/backend/services/__pycache__/screener_service.cpython-314.pyc deleted file mode 100644 index 5a2b7f3..0000000 Binary files a/src/backend/services/__pycache__/screener_service.cpython-314.pyc and /dev/null differ diff --git a/src/backend/services/__pycache__/sec_service.cpython-314.pyc b/src/backend/services/__pycache__/sec_service.cpython-314.pyc deleted file mode 100644 index c98e647..0000000 Binary files a/src/backend/services/__pycache__/sec_service.cpython-314.pyc and /dev/null differ diff --git a/src/backend/services/__pycache__/sentiment_service.cpython-314.pyc b/src/backend/services/__pycache__/sentiment_service.cpython-314.pyc deleted file mode 100644 index a24fec4..0000000 Binary files a/src/backend/services/__pycache__/sentiment_service.cpython-314.pyc and /dev/null differ diff --git a/src/backend/tasks/__pycache__/__init__.cpython-314.pyc b/src/backend/tasks/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index a1225f2..0000000 Binary files a/src/backend/tasks/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/src/backend/tasks/__pycache__/ingest_prices.cpython-314.pyc b/src/backend/tasks/__pycache__/ingest_prices.cpython-314.pyc deleted file mode 100644 index 7baf8be..0000000 Binary files a/src/backend/tasks/__pycache__/ingest_prices.cpython-314.pyc and /dev/null differ diff --git a/src/backend/tasks/__pycache__/ingest_sec.cpython-314.pyc b/src/backend/tasks/__pycache__/ingest_sec.cpython-314.pyc deleted file mode 100644 index f1e6d33..0000000 Binary files a/src/backend/tasks/__pycache__/ingest_sec.cpython-314.pyc and /dev/null differ diff --git a/src/backend/tasks/__pycache__/sector_scan.cpython-314.pyc b/src/backend/tasks/__pycache__/sector_scan.cpython-314.pyc deleted file mode 100644 index 64a32ad..0000000 Binary files a/src/backend/tasks/__pycache__/sector_scan.cpython-314.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/__init__.cpython-314.pyc b/src/backend/tests/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index 9a610f3..0000000 Binary files a/src/backend/tests/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/conftest.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/conftest.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index 7eb3d2c..0000000 Binary files a/src/backend/tests/__pycache__/conftest.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_alerts.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_alerts.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index 2177ef5..0000000 Binary files a/src/backend/tests/__pycache__/test_alerts.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_api.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_api.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index f0304e3..0000000 Binary files a/src/backend/tests/__pycache__/test_api.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_auth.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_auth.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index b2828bb..0000000 Binary files a/src/backend/tests/__pycache__/test_auth.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_dashboard.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_dashboard.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index 8b1d302..0000000 Binary files a/src/backend/tests/__pycache__/test_dashboard.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_insider_trades.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_insider_trades.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index 91e6ffe..0000000 Binary files a/src/backend/tests/__pycache__/test_insider_trades.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_market_data.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_market_data.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index 0bb0127..0000000 Binary files a/src/backend/tests/__pycache__/test_market_data.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_peers.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_peers.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index e71e46e..0000000 Binary files a/src/backend/tests/__pycache__/test_peers.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_screeners.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_screeners.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index 5c63339..0000000 Binary files a/src/backend/tests/__pycache__/test_screeners.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_search.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_search.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index 5924555..0000000 Binary files a/src/backend/tests/__pycache__/test_search.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_sec_filings.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_sec_filings.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index c314861..0000000 Binary files a/src/backend/tests/__pycache__/test_sec_filings.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_sentiment.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_sentiment.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index 497f7cd..0000000 Binary files a/src/backend/tests/__pycache__/test_sentiment.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_stocks.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_stocks.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index 2bd3b53..0000000 Binary files a/src/backend/tests/__pycache__/test_stocks.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_strategies.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_strategies.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index ea46bb9..0000000 Binary files a/src/backend/tests/__pycache__/test_strategies.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/__pycache__/test_watchlists.cpython-314-pytest-9.0.3.pyc b/src/backend/tests/__pycache__/test_watchlists.cpython-314-pytest-9.0.3.pyc deleted file mode 100644 index caf8ba3..0000000 Binary files a/src/backend/tests/__pycache__/test_watchlists.cpython-314-pytest-9.0.3.pyc and /dev/null differ diff --git a/src/backend/tests/conftest.py.bak b/src/backend/tests/conftest.py.bak deleted file mode 100644 index b7d2c61..0000000 --- a/src/backend/tests/conftest.py.bak +++ /dev/null @@ -1,169 +0,0 @@ -"""Shared fixtures for all backend tests. - -CRITICAL: The database mock must be injected into sys.modules BEFORE -any other imports that might trigger database.py to load. This is why -the mock is created at module level (lines 13-27) before any imports. -""" - -import asyncio -import sys -import types -from unittest.mock import AsyncMock - -import pytest -from httpx import AsyncClient, ASGITransport - -# ── Mock database module (MUST be before any imports) ────────────── -_db_mock = AsyncMock() -_db_mock.execute_query = AsyncMock(return_value=[]) -_db_mock.execute_command = AsyncMock(return_value=None) -_db_mock.execute_one = AsyncMock(return_value=None) -_db_mock.init_db = AsyncMock() -_db_mock.close_db = AsyncMock() -_db_mock.get_connection = AsyncMock() -_db_mock.release_connection = AsyncMock() - -_db_mod = types.ModuleType("database") -_db_mod.execute_query = _db_mock.execute_query -_db_mod.execute_command = _db_mock.execute_command -_db_mod.execute_one = _db_mock.execute_one -_db_mod.init_db = _db_mock.init_db -_db_mod.close_db = _db_mock.close_db -_db_mod.get_connection = _db_mock.get_connection -_db_mod.release_connection = _db_mock.release_connection -sys.modules["database"] = _db_mod -# ──────────────────────────────────────────────────────────────────── - - -@pytest.fixture -def event_loop(): - """Create a fresh event loop for each test.""" - loop = asyncio.new_event_loop() - yield loop - loop.close() - - -@pytest.fixture -def mock_db(): - """Return the shared mock database object.""" - return _db_mock - - -@pytest.fixture -def mock_user_data(): - """Valid user registration data.""" - return { - "email": "test@example.com", - "password": "SecurePass123!", - "name": "Test User", - } - - -@pytest.fixture -def mock_watchlist_data(): - """Valid watchlist creation data.""" - return { - "name": "My Watchlist", - "description": "Test watchlist for AAPL", - } - - -@pytest.fixture -def mock_watchlist_item(): - """Valid watchlist item data.""" - return { - "ticker": "AAPL", - "type": "stock", - "notes": "Apple Inc.", - } - - -@pytest.fixture -def mock_stock_profile(): - """Mock stock profile data.""" - return { - "ticker": "AAPL", - "name": "Apple Inc.", - "sector": "Technology", - "industry": "Consumer Electronics", - "pe_ratio": 32.5, - "market_cap": 3_000_000_000_000, - "price": 180.0, - "change_pct": 2.5, - "volume": 50_000_000, - "description": "Apple Inc. designs, manufactures, and sells consumer electronics.", - } - - -@pytest.fixture -def mock_price_data(): - """Mock price history data.""" - return [ - { - "date": "2024-01-02", - "open": 185.0, - "high": 187.0, - "low": 183.0, - "close": 186.5, - "volume": 50_000_000, - }, - { - "date": "2024-01-03", - "open": 186.5, - "high": 189.0, - "low": 185.0, - "close": 187.0, - "volume": 52_000_000, - }, - ] - - -@pytest.fixture -def mock_search_results(): - """Mock search results.""" - return [ - { - "ticker": "AAPL", - "name": "Apple Inc.", - "sector": "Technology", - "exchange": "NASDAQ", - }, - { - "ticker": "AAPL34.SA", - "name": "Apple Inc. BDR", - "sector": "Technology", - "exchange": "BVMF", - }, - ] - - -@pytest.fixture -def test_user(mock_db): - """Create a test user with a valid JWT token.""" - from services.auth import create_access_token - token = create_access_token( - data={"sub": "0000-01", "email": "test@example.com"}, - ) - return { - "token": token, - "user_id": "0000-01", - "email": "test@example.com", - "name": "Test User", - } - - -@pytest.fixture -def app(mock_db): - """Create a FastAPI app with mocked database.""" - # At this point, sys.modules["database"] is already patched (module-level). - # Import main — it will pick up our mock. - import main - return main.app - - -@pytest.fixture -async def client(app, mock_db): - """Create an async test client with mocked database.""" - transport = ASGITransport(app=app) - async with AsyncClient(transport=transport, base_url="http://test") as ac: - yield ac