forked from Rockachopa/Timmy-time-dashboard
Audit cleanup: security fixes, code reduction, test hygiene (#131)
This commit is contained in:
committed by
GitHub
parent
e8f1dea3ec
commit
aff3edb06a
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user