mirror of
https://github.com/grillazz/fastapi-sqlalchemy-asyncpg.git
synced 2025-11-30 13:20:40 +03:00
move delete method to base class, minor api updates and code linting
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
import pytest
|
||||
from httpx import AsyncClient
|
||||
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.ext.asyncio import create_async_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.pool import NullPool
|
||||
|
||||
from the_app.main import app
|
||||
from the_app import config
|
||||
from the_app.database import get_db
|
||||
from the_app.main import app
|
||||
from the_app.models.base import Base
|
||||
|
||||
from sqlalchemy.pool import NullPool
|
||||
|
||||
global_settings = config.get_settings()
|
||||
url = global_settings.asyncpg_test_url
|
||||
engine = create_async_engine(url, poolclass=NullPool)
|
||||
@@ -31,6 +28,7 @@ async def get_test_db():
|
||||
finally:
|
||||
await session.close()
|
||||
|
||||
|
||||
app.dependency_overrides[get_db] = get_test_db
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user