Files
meshcore-hub/tests/test_main.py
T
Louis King c643c50378 chore(db): remove v0.19 Postgres-transition shims
Remove the upgrade-compatibility items scheduled for v0.20 in the v0.19
release notes:

- the `meshcore-hub db migrate-to-postgres` command and its
  `common/db_migrate.py` module (with its dedicated tests)
- the `database_backend` settings field and its legacy-backend validator
  (a leftover DATABASE_BACKEND is now silently ignored)
- the `[postgres]` pip extra alias (Dockerfile installs `.` now)

`tests/test_main.py` is rewritten as a minimal CLI smoke test to keep
entry-point coverage. Docs updated: v0.20.0 upgrade section notes the
removals (SQLite deployments must upgrade through v0.19 first), README
and database.md pointers reworded, stale .env.example comment dropped.
2026-08-30 22:20:16 +01:00

40 lines
1.1 KiB
Python

"""Smoke tests for the top-level CLI entry point.
Verify the ``cli`` group wiring: version reporting, help output, and the
registered component subcommands (collector, api, web, db).
"""
from click.testing import CliRunner
from meshcore_hub import __version__
from meshcore_hub.__main__ import cli
def test_version_reports_package_version() -> None:
"""--version prints the package version and exits 0."""
runner = CliRunner()
result = runner.invoke(cli, ["--version"])
assert result.exit_code == 0
assert __version__ in result.output
def test_help_lists_component_commands() -> None:
"""--help advertises the component subcommands."""
runner = CliRunner()
result = runner.invoke(cli, ["--help"])
assert result.exit_code == 0
for command in ("collector", "api", "web", "db"):
assert command in result.output
def test_db_help_lists_migration_commands() -> None:
"""db --help advertises the Alembic migration commands."""
runner = CliRunner()
result = runner.invoke(cli, ["db", "--help"])
assert result.exit_code == 0
assert "upgrade" in result.output
assert "downgrade" in result.output