"""Argument parsing for `python -m src.cli.provision_tenant`. Only the argv -> arguments mapping is covered here; the provisioning behaviour itself needs a real database and lives in `tests/integration/postgres/test_provisioning.py`. """ import pytest from src.application.tenants import DEFAULT_SCOPES from src.cli.provision_tenant import _parse_args pytestmark = pytest.mark.unit def test_parse_args_defaults_scopes_and_domains() -> None: args = _parse_args(["--slug", "acme"]) assert args.slug == "acme" assert args.name is None assert args.key_name == "bootstrap" assert tuple(args.scopes.split(",")) == DEFAULT_SCOPES assert args.domains == [] def test_parse_args_collects_repeated_domain_flags() -> None: args = _parse_args(["--slug", "acme", "--domain", "fire", "--domain", "life"]) assert args.domains == ["fire", "life"] def test_parse_args_requires_a_slug() -> None: with pytest.raises(SystemExit): _parse_args(["--domain", "fire"])