"""Tests for `agnes pull` Typer wrapper.""" from typer.testing import CliRunner from cli.commands.pull import pull_app runner = CliRunner() def test_pull_help(): result = runner.invoke(pull_app, ["--help"]) assert result.exit_code == 0 assert "--quiet" in result.output assert "--json" in result.output assert "--dry-run" in result.output def test_pull_no_server_friendly_exit(tmp_path, monkeypatch): """No configured server -> exit 1 with friendly hint (no traceback).""" monkeypatch.setenv("AGNES_CONFIG_DIR", str(tmp_path / "_cfg")) monkeypatch.delenv("AGNES_SERVER", raising=False) monkeypatch.delenv("AGNES_TOKEN", raising=False) result = runner.invoke(pull_app, []) # Either exit 1 with hint, or exit 0 if a default server URL applies. # Either way, there must be no Python traceback in stderr/stdout. assert "Traceback" not in (result.output + (result.stderr or ""))