flexigo-support-bot / tests /test_smoke.py
victor34593993's picture
deploy flexigo support bot
187966e verified
Raw
History Blame
670 Bytes
"""Smoke test: the async DB fixture can create tables and round-trip a row."""
from __future__ import annotations
from sqlalchemy import Integer, String, select
from sqlalchemy.orm import Mapped, mapped_column
from app.db import Base
class _Widget(Base):
__tablename__ = "_smoke_widget"
id: Mapped[int] = mapped_column(Integer, primary_key=True)
name: Mapped[str] = mapped_column(String(50))
async def test_db_fixture_creates_tables(db_session):
db_session.add(_Widget(name="hello"))
await db_session.commit()
rows = (await db_session.execute(select(_Widget))).scalars().all()
assert len(rows) == 1
assert rows[0].name == "hello"