Don't resize terminal on session disconnect
Rename DISCONNECT_RESIZE to DEFAULT_TERMINAL_SIZE Update tests for removed _resize_on_disconnect and stricter available check Bump version to 0.2.7
This commit is contained in:
@@ -67,13 +67,16 @@ class TestDockerStatsCollector:
|
||||
"""Tests for Docker stats collector."""
|
||||
|
||||
def test_available_checks_socket(self, tmp_path):
|
||||
"""available property checks socket existence."""
|
||||
"""available property checks socket existence and connectivity."""
|
||||
socket_path = tmp_path / "docker.sock"
|
||||
collector = DockerStatsCollector(str(socket_path))
|
||||
assert collector.available is False
|
||||
|
||||
# Just touching the file isn't enough - need actual socket connectivity
|
||||
# Since we can't easily create a real Unix socket in tests,
|
||||
# verify that a non-socket file returns False
|
||||
socket_path.touch()
|
||||
assert collector.available is True
|
||||
assert collector.available is False # File exists but can't connect
|
||||
|
||||
def test_get_cpu_history_empty(self):
|
||||
"""Empty history returns empty list."""
|
||||
|
||||
@@ -167,17 +167,6 @@ class TestLocalServerHelpers:
|
||||
assert session_created is True
|
||||
ws.send_json.assert_awaited_once_with(["error", "No app configured"])
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_resize_on_disconnect_calls_set_terminal_size(self, server, monkeypatch):
|
||||
session = MagicMock()
|
||||
session.set_terminal_size = AsyncMock()
|
||||
|
||||
monkeypatch.setattr(server.session_manager, "get_session_by_route_key", lambda _rk: session)
|
||||
|
||||
await server._resize_on_disconnect("rk")
|
||||
|
||||
session.set_terminal_size.assert_called_once_with(132, 45)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_terminal_session_sends_error_if_no_apps(self, server):
|
||||
ws = MagicMock()
|
||||
|
||||
Reference in New Issue
Block a user