mirror of
https://github.com/creyD/creyPY.git
synced 2026-04-12 19:30:30 +02:00
fix: fixed multiple bugs in database handling
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
from typing import AsyncGenerator
|
||||
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
||||
|
||||
from .common import SQLALCHEMY_DATABASE_URL, name
|
||||
from .common import SQLALCHEMY_DATABASE_URL, name, ssl_mode
|
||||
|
||||
async_engine = create_async_engine(
|
||||
SQLALCHEMY_DATABASE_URL + name, pool_pre_ping=True, connect_args={"sslmode": "require"}
|
||||
SQLALCHEMY_DATABASE_URL + name, pool_pre_ping=True, connect_args={"sslmode": ssl_mode}
|
||||
)
|
||||
|
||||
AsyncSessionLocal = sessionmaker(
|
||||
AsyncSessionLocal = async_sessionmaker(
|
||||
bind=async_engine,
|
||||
class_=AsyncSession,
|
||||
expire_on_commit=False,
|
||||
|
||||
@@ -20,7 +20,6 @@ class AbstractTestAPI(unittest.IsolatedAsyncioTestCase):
|
||||
transport=ASGITransport(app=app), base_url="http://testserver", follow_redirects=True
|
||||
)
|
||||
cls.default_headers = headers
|
||||
print("setting up abstract")
|
||||
|
||||
@classmethod
|
||||
def setup_database(
|
||||
@@ -52,7 +51,7 @@ class AbstractTestAPI(unittest.IsolatedAsyncioTestCase):
|
||||
async_db_url,
|
||||
echo=False,
|
||||
pool_pre_ping=True,
|
||||
connect_args={"sslmode": "require"},
|
||||
connect_args={"sslmode": ssl_mode},
|
||||
)
|
||||
|
||||
async def get(self, url: str, r_code: int = 200, parse_json=True) -> dict | bytes:
|
||||
|
||||
Reference in New Issue
Block a user