Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -91,3 +91,18 @@ def test_rejects_non_read_only_systemctl_subcommand() -> None:
|
||||
|
||||
with pytest.raises(SSHCommandRejectedError):
|
||||
client.validate_read_only_command("systemctl restart apache2")
|
||||
|
||||
|
||||
def test_truncate_output_marks_and_limits_content() -> None:
|
||||
text = "a" * 400
|
||||
rendered, truncated = SSHClient._truncate_output(text, max_output_bytes=256)
|
||||
|
||||
assert truncated is True
|
||||
assert rendered.endswith("...[truncated]")
|
||||
|
||||
|
||||
def test_truncate_output_keeps_short_content() -> None:
|
||||
rendered, truncated = SSHClient._truncate_output("short output", max_output_bytes=256)
|
||||
|
||||
assert truncated is False
|
||||
assert rendered == "short output"
|
||||
|
||||
Reference in New Issue
Block a user