You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iTi-Flask/tests/test_framework_migrations.py

20 lines
723 B
Python

from click.testing import CliRunner
from iti.cli import iti_cli
def test_sync_framework_migrations_is_idempotent(tmp_path):
target = tmp_path / "migrations" / "versions"
runner = CliRunner()
migration_name = "20260508_0433_7de264f96a03_framework_initial_schema.py"
first = runner.invoke(iti_cli, ["migrations", "sync", "--target", str(target)])
assert first.exit_code == 0
assert f"synced: {migration_name}" in first.output
assert (target / migration_name).exists()
assert not (target / "__init__.py").exists()
second = runner.invoke(iti_cli, ["migrations", "sync", "--target", str(target)])
assert second.exit_code == 0
assert f"skipped: {migration_name}" in second.output