2026-06-23 14:16:16 +02:00
|
|
|
"""SSH config behavior."""
|
|
|
|
|
|
|
|
|
|
from sandboxer.extensions.ssh import SSHConfig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_destination_uses_ssh_config_when_user_unset() -> None:
|
|
|
|
|
ssh = SSHConfig(host="92.205.130.254")
|
|
|
|
|
assert ssh.destination == "92.205.130.254"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_destination_includes_explicit_user() -> None:
|
|
|
|
|
ssh = SSHConfig(host="92.205.130.254", user="tegwick")
|
2026-06-24 01:47:07 +02:00
|
|
|
assert ssh.destination == "tegwick@92.205.130.254"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_ssh_base_includes_port() -> None:
|
|
|
|
|
ssh = SSHConfig(host="localhost", user="build", port=12222)
|
|
|
|
|
assert "-p" in ssh.ssh_base()
|
|
|
|
|
assert "12222" in ssh.ssh_base()
|