fix: ruff lint + format fixes in tests, ESLint fixes in frontend
This commit is contained in:
@@ -5,7 +5,6 @@ from typing import AsyncGenerator
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
from sqlalchemy import delete
|
||||
from sqlalchemy.ext.asyncio import (
|
||||
AsyncSession,
|
||||
async_sessionmaker,
|
||||
@@ -26,6 +25,7 @@ TEST_DATABASE_URL = (
|
||||
def event_loop():
|
||||
"""Create a fresh event loop per test for asyncpg compatibility."""
|
||||
import asyncio
|
||||
|
||||
loop = asyncio.new_event_loop()
|
||||
yield loop
|
||||
loop.close()
|
||||
@@ -117,6 +117,7 @@ async def inactive_user(db_session: AsyncSession) -> User:
|
||||
def _get_test_token(user: User) -> str:
|
||||
"""Generate an access token for a test user."""
|
||||
from app.utils.jwt import create_access_token
|
||||
|
||||
role_val = user.role.value if isinstance(user.role, UserRole) else str(user.role)
|
||||
return create_access_token(
|
||||
user_id=str(user.id),
|
||||
@@ -141,6 +142,7 @@ async def verkaeufer_token(verkaeufer_user: User) -> str:
|
||||
@pytest_asyncio.fixture
|
||||
async def client(test_session_factory) -> AsyncGenerator[AsyncClient, None]:
|
||||
"""Async HTTP test client with DB session override."""
|
||||
|
||||
async def _override_get_db():
|
||||
async with test_session_factory() as session:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user