test: fix test_models to use test engine and import models
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
a8e3ad8e16
commit
44c37420af
29
backend/tests/test_models.py
Normal file
29
backend/tests/test_models.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import pytest
|
||||||
|
from sqlalchemy import inspect
|
||||||
|
|
||||||
|
from app.database import Base
|
||||||
|
from app.models import (
|
||||||
|
Conversation,
|
||||||
|
DigitalEmployee,
|
||||||
|
Document,
|
||||||
|
KnowledgeBase,
|
||||||
|
Tenant,
|
||||||
|
TenantConfig,
|
||||||
|
)
|
||||||
|
from tests.conftest import test_engine
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_all_tables_created():
|
||||||
|
expected_tables = {
|
||||||
|
"tenants",
|
||||||
|
"tenant_configs",
|
||||||
|
"digital_employees",
|
||||||
|
"conversations",
|
||||||
|
"messages",
|
||||||
|
"knowledge_bases",
|
||||||
|
"documents",
|
||||||
|
}
|
||||||
|
async with test_engine.begin() as conn:
|
||||||
|
tables = await conn.run_sync(lambda sync_conn: inspect(sync_conn).get_table_names())
|
||||||
|
assert set(tables) == expected_tables
|
||||||
Loading…
x
Reference in New Issue
Block a user