From a2a4b461e7054f712ef19b15caf95e2b56b83d52 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Wed, 15 May 2024 18:31:16 +0000 Subject: [PATCH] test(websocket): ping pong test --- tests/test_graphql/test_websocket.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_graphql/test_websocket.py b/tests/test_graphql/test_websocket.py index 2431285..ef71312 100644 --- a/tests/test_graphql/test_websocket.py +++ b/tests/test_graphql/test_websocket.py @@ -29,7 +29,7 @@ def test_websocket_connection_bare(authorized_client): assert websocket.scope is not None -def test_websocket_graphql_init(authorized_client): +def test_websocket_graphql_ping(authorized_client): client = authorized_client with client.websocket_connect( "/graphql", subprotocols=["graphql-transport-ws"] @@ -38,6 +38,11 @@ def test_websocket_graphql_init(authorized_client): ack = websocket.receive_json() assert ack == {"type": "connection_ack"} + # https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md#ping + websocket.send_json({"type": "ping", "payload": {}}) + pong = websocket.receive_json() + assert pong == {"type": "pong"} + # def test_websocket_subscription(authorized_client): # client = authorized_client