feat: strengthen backup and mobile workflows
This commit is contained in:
+12
-1
@@ -1,8 +1,10 @@
|
||||
import asyncio
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
from sqlalchemy import event
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -11,9 +13,18 @@ def client(tmp_path: Path):
|
||||
os.environ["DODO_AUTO_CREATE_SCHEMA"] = "true"
|
||||
from backend.config import get_settings
|
||||
get_settings.cache_clear()
|
||||
from backend.db import reset_engine
|
||||
from backend.db import get_engine, reset_engine
|
||||
reset_engine()
|
||||
engine = get_engine()
|
||||
|
||||
@event.listens_for(engine.sync_engine, "connect")
|
||||
def enable_sqlite_foreign_keys(dbapi_connection, _):
|
||||
cursor = dbapi_connection.cursor()
|
||||
cursor.execute("PRAGMA foreign_keys=ON")
|
||||
cursor.close()
|
||||
|
||||
from backend.main import app
|
||||
with TestClient(app) as test_client:
|
||||
yield test_client
|
||||
asyncio.run(engine.dispose())
|
||||
reset_engine()
|
||||
|
||||
Reference in New Issue
Block a user