88ab5b917e
Renames the Python package directory, CLI command, env var prefix, docker-compose service/container/image, Postgres role/db, and all visible branding. Marketing form is "Fabled Steward". Clean break from the previous rebrand: drops the fabledscryer→roundtable import shim in __init__.py and the FABLEDSCRYER_* env var fallback in config.py and migrations/env.py. Env vars are now STEWARD_* only. Heads-up for existing deployments: - Postgres user/db renamed fabledscryer → steward in docker-compose.yml. Existing volumes need the role/db renamed inside Postgres, or override POSTGRES_USER/POSTGRES_DB to keep the old names. - Host-agent systemd unit is now steward-agent.service. Existing agents keep running under the old name; reinstall to switch. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
import os
|
|
import textwrap
|
|
import pytest
|
|
from steward.config import load_bootstrap
|
|
|
|
|
|
def test_load_bootstrap_from_yaml(tmp_path):
|
|
cfg_file = tmp_path / "config.yaml"
|
|
cfg_file.write_text(textwrap.dedent("""\
|
|
database:
|
|
url: postgresql+asyncpg://user:pass@localhost/steward
|
|
secret_key: test-secret
|
|
"""))
|
|
cfg = load_bootstrap(cfg_file)
|
|
assert cfg["database_url"] == "postgresql+asyncpg://user:pass@localhost/steward"
|
|
assert cfg["secret_key"] == "test-secret"
|
|
|
|
|
|
def test_env_var_database_url_overrides_yaml(tmp_path, monkeypatch):
|
|
cfg_file = tmp_path / "config.yaml"
|
|
cfg_file.write_text("database:\n url: original\nsecret_key: s\n")
|
|
monkeypatch.setenv("STEWARD_DATABASE_URL", "overridden")
|
|
cfg = load_bootstrap(cfg_file)
|
|
assert cfg["database_url"] == "overridden"
|
|
|
|
|
|
def test_env_var_secret_key_overrides_yaml(tmp_path, monkeypatch):
|
|
cfg_file = tmp_path / "config.yaml"
|
|
cfg_file.write_text("database:\n url: x\nsecret_key: from-yaml\n")
|
|
monkeypatch.setenv("STEWARD_SECRET_KEY", "from-env")
|
|
cfg = load_bootstrap(cfg_file)
|
|
assert cfg["secret_key"] == "from-env"
|
|
|
|
|
|
def test_missing_database_url_raises(tmp_path):
|
|
cfg_file = tmp_path / "config.yaml"
|
|
cfg_file.write_text("secret_key: s\n")
|
|
with pytest.raises(ValueError, match="Database URL is required"):
|
|
load_bootstrap(cfg_file)
|