fix rate-limit valid login bug and fix sessions of redis and psql in tests

This commit is contained in:
2026-09-05 21:55:31 +03:00
parent c4a6a88d05
commit 9fd44c0ad9
8 changed files with 50 additions and 30 deletions
+17 -1
View File
@@ -1,6 +1,9 @@
import pytest_asyncio
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
from src.models.configs_read.env import env_settings
from src.service.auth.jwt import HashService, JwtService
from src.service.users_crud.users_crud import CrudService
@pytest_asyncio.fixture
@@ -11,4 +14,17 @@ async def jwt_service()->JwtService:
@pytest_asyncio.fixture
async def hash_service()->HashService:
hash_service=HashService()
return hash_service
return hash_service
@pytest_asyncio.fixture
async def crud_service():
test_engine = create_async_engine(f"postgresql+asyncpg://{env_settings.DB_USER}:{env_settings.DB_PASSWORD}@{env_settings.DB_HOST}:{env_settings.DB_PORT}/{env_settings.DB_POSTGRESS}",
pool_size=20,
max_overflow=10,
pool_timeout=30,
pool_pre_ping=True
)
crud_service = CrudService()
crud_service.crud_db_actions.Session = async_sessionmaker(bind=test_engine)
yield crud_service
await test_engine.dispose()