Public Access
mirror of
https://github.com/xlorepdarkhelm/numinar-coding-project.git
synced 2026-09-11 10:28:45 -04:00
my models to not use it, and separated the concerns a bit better. Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
19 lines
594 B
Python
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)
|