Files
conference-room-booking-system/backend/tests/test_models.py
T
darkhelm 6ae0abfb48 I noticed that the rules said explicitly no SQLModel, so I restructured
my models to not use it, and separated the concerns a bit better.

Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
2025-08-22 15:46:34 -04:00

19 lines
594 B
Python

"""Test for the create_db_and_tables function in backend.models."""
from unittest.mock import patch
from backend.models import Base
from backend.models import create_db_and_tables
from backend.models import engine
def test_create_db_and_tables() -> None:
"""Test the create_db_and_tables function.
Verifies that the function correctly calls SQLModel.metadata.create_all with
the synchronous engine.
"""
with patch.object(Base.metadata, "create_all") as mock_create_all:
create_db_and_tables()
mock_create_all.assert_called_once_with(engine.sync_engine)