mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-15 01:14:53 +03:00
Added ping test for websocket
This commit is contained in:
parent
f9122a55a8
commit
5381b482ef
|
@ -22,3 +22,16 @@ def test_accept_connection():
|
|||
is_open = loop.run_until_complete(open_connection(url))
|
||||
assert is_open
|
||||
loop.close()
|
||||
|
||||
|
||||
def test_ping():
|
||||
async def ping(url):
|
||||
async with connect(url) as websocket:
|
||||
await websocket.send("ping")
|
||||
return await websocket.recv()
|
||||
|
||||
with run_server() as url:
|
||||
loop = new_event_loop()
|
||||
received_message = loop.run_until_complete(ping(url))
|
||||
assert received_message == "pong"
|
||||
loop.close()
|
||||
|
|
Loading…
Reference in New Issue
Block a user