pydantic v1 + import fixes

This commit is contained in:
Kyle Santiago
2025-08-04 19:26:19 -04:00
parent 01beaa93c6
commit bd354ac3e8
13 changed files with 25 additions and 25 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import math
import os
from pydantic import BaseModel
from pydantic.v1 import BaseModel
from ..core import get_logger
from .models import MODELS
+13 -13
View File
@@ -28,8 +28,8 @@ os.environ.update(
}
)
from router.db import ApiKey, get_session
from router.main import app, lifespan
from router.core.db import ApiKey, get_session
from router.core.main import app, lifespan
class TestmintWallet:
@@ -338,19 +338,19 @@ async def integration_app(
real_wallet = await create_real_mint_wallet()
with (
patch("router.db.engine", integration_engine),
patch("router.cashu.wallet_instance", real_wallet.wallet),
patch("router.cashu.wallet", lambda: real_wallet.wallet),
patch("router.cashu.init_wallet", AsyncMock()),
patch("router.core.db.engine", integration_engine),
patch("router.wallet.wallet_instance", real_wallet.wallet),
patch("router.wallet.wallet", lambda: real_wallet.wallet),
patch("router.wallet.init_wallet", AsyncMock()),
):
yield test_app
else:
# Use mock testmint wallet (current implementation)
with patch("router.db.engine", integration_engine):
with patch("router.core.db.engine", integration_engine):
# Set up the test wallet instance
import router.cashu
import router.wallet
original_wallet_instance = router.cashu.wallet_instance
original_wallet_instance = router.wallet.wallet_instance
# Create a wallet adapter that uses our testmint_wallet
mock_wallet = AsyncMock()
@@ -362,21 +362,21 @@ async def integration_app(
# Patch the wallet functions to use our test wallet
with (
patch("router.cashu.wallet") as mock_wallet_func,
patch("router.cashu.init_wallet") as mock_init_wallet,
patch("router.wallet.wallet") as mock_wallet_func,
patch("router.wallet.init_wallet") as mock_init_wallet,
):
# Configure to return our test wallet
mock_wallet_func.return_value = mock_wallet
mock_init_wallet.return_value = None
# Set the global wallet_instance
router.cashu.wallet_instance = mock_wallet
router.wallet.wallet_instance = mock_wallet
try:
yield test_app
finally:
# Restore original wallet_instance
router.cashu.wallet_instance = original_wallet_instance
router.wallet.wallet_instance = original_wallet_instance
@pytest_asyncio.fixture
+1 -1
View File
@@ -11,7 +11,7 @@ import pytest
import router.cashu
from router.cashu import check_for_refunds, periodic_payout
from router.db import ApiKey
from router.core.db import ApiKey
from router.models import MODELS, Model, Pricing, update_sats_pricing
@@ -11,7 +11,7 @@ from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.asyncio import AsyncSession
from sqlmodel import select
from router.db import ApiKey
from router.core.db import ApiKey
class TestTransactionAtomicity:
@@ -10,7 +10,7 @@ from httpx import AsyncClient, ConnectError
from sqlalchemy.ext.asyncio import AsyncSession
from sqlmodel import select
from router.db import ApiKey
from router.core.db import ApiKey
class TestNetworkFailureScenarios:
+1 -1
View File
@@ -149,7 +149,7 @@ class TestPerformanceBaseline:
"""Test database operation performance"""
from sqlmodel import select
from router.db import ApiKey
from router.core.db import ApiKey
# Create test data
for i in range(100):
@@ -14,7 +14,7 @@ import pytest
from httpx import AsyncClient
from sqlmodel import select
from router.db import ApiKey
from router.core.db import ApiKey
from tests.integration.utils import (
ConcurrencyTester,
PerformanceValidator,
@@ -11,7 +11,7 @@ import pytest
from httpx import AsyncClient
from sqlmodel import select
from router.db import ApiKey
from router.core.db import ApiKey
from tests.integration.utils import (
CashuTokenGenerator,
ConcurrencyTester,
+1 -1
View File
@@ -11,7 +11,7 @@ import pytest
from httpx import AsyncClient
from sqlmodel import select, update
from router.db import ApiKey
from router.core.db import ApiKey
from tests.integration.utils import ConcurrencyTester, ResponseValidator
+1 -1
View File
@@ -13,7 +13,7 @@ import pytest
from httpx import AsyncClient
from sqlmodel import select
from router.db import ApiKey
from router.core.db import ApiKey
@pytest.mark.integration
+1 -1
View File
@@ -11,7 +11,7 @@ import pytest
from httpx import AsyncClient
from sqlmodel import select
from router.db import ApiKey
from router.core.db import ApiKey
from tests.integration.utils import (
CashuTokenGenerator,
ConcurrencyTester,
+1 -1
View File
@@ -9,7 +9,7 @@ import httpx
from sqlalchemy.ext.asyncio import AsyncSession
from sqlmodel import select
from router.db import ApiKey
from router.core.db import ApiKey
class CashuTokenGenerator:
+1 -1
View File
@@ -45,7 +45,7 @@ def check_imports() -> bool:
# Check router modules - imports are for verification only
from router.cashu import Wallet
from router.db import ApiKey
from router.core.db import ApiKey
del Wallet, ApiKey