test: Increase test coverage to 100% for app/websockets module
Summary
The app/websockets module currently has incomplete test coverage on two files:
| File | Stmts | Miss | Cover |
|---|---|---|---|
app/websockets/socketio_queue_manager.py |
80 | 12 | 85% |
app/websockets/websocket_manager.py |
85 | 34 | 60% |
The other two files already have 100% coverage:
-
app/websockets/__init__.py— 100% -
app/websockets/consultation_queue_websocket_manager.py— 100%
Goal
Bring all files in app/websockets/ to 100% test coverage with valid tests.
Requirements
- Cover all branches, edge cases, and error paths
- Fix genuine bugs if found
Key areas to cover
websocket_manager.py (60% → 100%)
-
websocket_endpoint()function — room joining (join:analytics,join:queue, genericjoin), duplicate join prevention, disconnect cleanup -
ConnectionManageredge cases — disconnect when not in room, broadcast to nonexistent room -
emit_queue_status_updatedefaultpatient_info=Nonepath
socketio_queue_manager.py (85% → 100%)
- SocketIO event handlers:
connect,disconnect,leave_queue_room,request_queue_update -
get_queue_data()—queue_publicandqueue_doctorsroom branches, null patient/doctor/timestamp edge cases -
broadcast_queue_update()andnotify_queue_change()with defaultrooms=None - Convenience functions (
broadcast_queue_update,notify_queue_change)
Edited by Madavarapu Sai Harshavardhan