Files
importarr/tests/test_config.py
T

24 lines
890 B
Python

from importarr.config import Settings
def test_file_secret_env_vars_are_supported(tmp_path, monkeypatch):
sab_key = tmp_path / "sab-api-key"
auth_token = tmp_path / "auth-token"
sab_key.write_text("sab-secret\n", encoding="utf-8")
auth_token.write_text("auth-secret\n", encoding="utf-8")
monkeypatch.setenv("IMPORTARR_SAB_API_KEY_FILE", str(sab_key))
monkeypatch.setenv("IMPORTARR_AUTH_TOKEN_FILE", str(auth_token))
monkeypatch.setenv("IMPORTARR_STATE_PATH", str(tmp_path / "state.db"))
settings = Settings.from_env()
assert settings.sab_api_key == "sab-secret"
assert settings.auth_token == "auth-secret"
def test_default_update_command_uses_installed_absolute_path(monkeypatch):
monkeypatch.delenv("IMPORTARR_UPDATE_COMMAND", raising=False)
assert Settings.from_env().update_command == ["/bin/sh", "/opt/importarr/repo-upgrade.sh"]