Add takeover_enabled, takeover_mode, and takeover_delay_seconds columns to the Authorization model with a SQLite migration, and include them in to_dict(). Test: test_takeover_model.py.
27 lines
754 B
Python
27 lines
754 B
Python
import pytest
|
|
from database import init_db, SessionLocal
|
|
from models import Authorization
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
def setup_database():
|
|
"""Initialize DB tables and seed an Authorization row."""
|
|
init_db()
|
|
db = SessionLocal()
|
|
try:
|
|
existing = db.query(Authorization).first()
|
|
if existing is None:
|
|
auth = Authorization(
|
|
id="test-auth-1",
|
|
avatar_id="test-avatar-1",
|
|
target_type="user",
|
|
target_id="test-user-1",
|
|
target_name="Test User",
|
|
permissions=["read", "write"],
|
|
status="active",
|
|
)
|
|
db.add(auth)
|
|
db.commit()
|
|
finally:
|
|
db.close()
|