Skip to content

Commit

Permalink
Update websocket_unit_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Nissa9902 authored Nov 6, 2024
1 parent e5c26dd commit 8026220
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion backend/websocket_unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,12 @@ def test_websocket_disconnect():
data = websocket.receive_text()
assert data == "Hello"
websocket.close()
assert websocket.close
#assert websocket.close
assert websocket.client_state == "CLOSED"

# Try to receive a message after the connection is closed
try:
disconnection_message = websocket.receive_text()
assert disconnection_message == "Disconnected: Connection closed"
except Exception as e:
pytest.fail(f"Expected disconnection message not received. Error: {e}")

0 comments on commit 8026220

Please sign in to comment.