Audit cleanup: security fixes, code reduction, test hygiene (#131)

This commit is contained in:
Alexander Whitestone
2026-03-05 18:56:52 -05:00
committed by GitHub
parent e8f1dea3ec
commit aff3edb06a
33 changed files with 160 additions and 591 deletions

View File

@@ -22,9 +22,10 @@ def test_ws_manager_initial_state():
@pytest.mark.asyncio
async def test_ws_manager_event_history_limit():
"""History is trimmed to max_history after broadcasts."""
"""History is trimmed to maxlen after broadcasts."""
import collections
mgr = WebSocketManager()
mgr._max_history = 5
mgr._event_history = collections.deque(maxlen=5)
for i in range(10):
await mgr.broadcast(f"e{i}", {})
assert len(mgr.event_history) == 5

View File

@@ -67,8 +67,9 @@ class TestWebSocketManagerBroadcast:
@pytest.mark.asyncio
async def test_broadcast_trims_history(self):
import collections
mgr = WebSocketManager()
mgr._max_history = 3
mgr._event_history = collections.deque(maxlen=3)
for i in range(5):
await mgr.broadcast(f"e{i}", {})
assert len(mgr.event_history) == 3