You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
847 B
25 lines
847 B
import sqlite3
|
|
from pathlib import Path
|
|
|
|
from alembic import command
|
|
from alembic.config import Config
|
|
|
|
|
|
def test_alembic_upgrade_creates_core_tables(tmp_path: Path) -> None:
|
|
database_path = tmp_path / "migration.db"
|
|
database_url = f"sqlite+aiosqlite:///{database_path}"
|
|
|
|
alembic_config = Config("alembic.ini")
|
|
alembic_config.set_main_option("sqlalchemy.url", database_url)
|
|
|
|
command.upgrade(alembic_config, "head")
|
|
|
|
with sqlite3.connect(database_path) as connection:
|
|
cursor = connection.execute("SELECT name FROM sqlite_master WHERE type = 'table'")
|
|
table_names = {row[0] for row in cursor.fetchall()}
|
|
|
|
assert "users" in table_names
|
|
assert "directories" in table_names
|
|
assert "upload_sessions" in table_names
|
|
assert "blob_replicas" in table_names
|
|
assert "alembic_version" in table_names
|
|
|