Files
DECNET/tests/swarm/test_cli_forwarder.py
anti f2b3393669 chore: relicense to AGPL-3.0-or-later and add SPDX headers
Replaces LICENSE (GPLv3 -> AGPLv3) and prepends
`SPDX-License-Identifier: AGPL-3.0-or-later` to every source file
across decnet/, decnet_web/, tests/, scripts/, and tools/.

Rationale: closes the GPLv3 ASP loophole so any party operating a
modified DECNET as a network service must offer their modified
source. Personal copyright (Samuel Paschuan) + inbound=outbound
contributions make a future unilateral relicense infeasible.

- LICENSE: full AGPL-3.0 text (gnu.org/licenses/agpl-3.0.txt)
- COPYRIGHT: project copyright notice
- tools/add_spdx_headers.py: idempotent header injector
  (shebang- and PEP 263-aware)

Touches 1565 source files (.py, .ts, .tsx, .js, .jsx, .css, .sh).
No behavior change; comments only.
2026-05-22 21:04:16 -04:00

41 lines
1.3 KiB
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""CLI surface for `decnet forwarder`. Only guard clauses — the async
loop itself is covered by tests/swarm/test_log_forwarder.py."""
from __future__ import annotations
import pathlib
import pytest
from typer.testing import CliRunner
from decnet.cli import app
runner = CliRunner()
def test_forwarder_requires_master_host(monkeypatch: pytest.MonkeyPatch, tmp_path: pathlib.Path) -> None:
monkeypatch.delenv("DECNET_SWARM_MASTER_HOST", raising=False)
# Also patch the already-imported module-level constant.
monkeypatch.setattr("decnet.env.DECNET_SWARM_MASTER_HOST", None, raising=False)
result = runner.invoke(app, ["forwarder", "--log-file", str(tmp_path / "decnet.log")])
assert result.exit_code == 2
assert "master-host" in result.output
def test_forwarder_requires_bundle(monkeypatch: pytest.MonkeyPatch, tmp_path: pathlib.Path) -> None:
agent_dir = tmp_path / "agent" # empty
log_file = tmp_path / "decnet.log"
log_file.write_text("")
result = runner.invoke(
app,
[
"forwarder",
"--master-host", "127.0.0.1",
"--log-file", str(log_file),
"--agent-dir", str(agent_dir),
],
)
assert result.exit_code == 2
assert "bundle" in result.output